# Source for file Relation.php

Documentation is available at Relation.php

1. <?php
2. /*
3. * $Id: Relation.php 1080 2007-02-10 18:17:08Z romanb $
4. *
5. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16. *
17. * This software consists of voluntary contributions made by many individuals
18. * and is licensed under the LGPL. For more information, see
19. * <http://www.phpdoctrine.com>.
20. */
21. Doctrine::autoload('Doctrine_Schema_Object');
22. /**
23. * @package Doctrine
24. * @url http://www.phpdoctrine.com
25. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
26. * @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
27. * @version $Id: Relation.php 1080 2007-02-10 18:17:08Z romanb $
28. */
29. /**
30. * class Doctrine_Schema_Relation
31. * Holds information on a foreign key relation.
32. * @package Doctrine
33. * @category Object Relational Mapping
34. * @link www.phpdoctrine.com
35. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
36. * @since 1.0
37. * @version $Revision: 1080 $
38. * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
39. */
40. class Doctrine_Schema_Relation extends Doctrine_Schema_Object
41. {
43. /**
44. * Column that refers to another table
45. * @access public
46. */
47. public $referencingColumn;
49. /**
50. * Column that is referred from another table
51. * @access public
52. */
53. public $referencedColumn;
55. /**
56. * Table where the referred column lives
57. * @access public
58. *
59. */
60. public $referencedTable;
62. /**
63. * ON UPDATE or ON DELETE action
64. * @static
65. * @access public
66. */
67. public static $ACTION_RESTRICT = 1;
69. /**
70. * ON UPDATE or ON DELETE action
71. * @static
72. * @access public
73. */
74. public static $ACTION_SET_NULL = 2;
76. /**
77. * ON UPDATE or ON DELETE action
78. * @static
79. * @access public
80. */
81. public static $ACTION_CASCADE = 3;
83. /**
84. * ON UPDATE or ON DELETE action
85. * @static
86. * @access public
87. */
88. public static $ACTION_NO_ACTION = 4;
90. /**
91. * ON UPDATE or ON DELETE action
92. * @static
93. * @access public
94. */
95. public static $ACTION_SET_DEFAULT = 5;
97. /**
98. *
99. * @param Doctrine_Schema_Column referencing
100. * @param Doctrine_Schema_Table referencedtable
101. * @param Doctrine_Schema_Column referencedColumn
102. * @return
103. * @access public
104. */
105. public function setRelationBetween( $referencingColumn, $referencedTable, $referencedColumn )
106. {
107. $this->referencingColumn = $referencingColumn;
108. $this->referencedTable = $referencedTable;
109. $this->referencedColumn = $referencedColumn;
110. }
111. /**
112. * @return string
113. */
114. public function __toString( )
115. {
116. return "Relation between '".$this->referencingColumn."' and '".$this->referencedTable."'.'".$this->referencingColumn."'";
117. }
118. /**
119. *
120. * @return bool
121. */
122. public function isValid( )
123. {
125. }
126. }