1 |
<?php
|
2 |
/*
|
3 |
* $Id: Relation.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $
|
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 |
* class Doctrine_Schema_Relation
|
24 |
* Holds information on a foreign key relation.
|
25 |
*
|
26 |
* @package Doctrine
|
27 |
* @subpackage Schema
|
28 |
* @link www.phpdoctrine.com
|
29 |
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
30 |
* @since 1.0
|
31 |
* @version $Revision: 2702 $
|
32 |
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
33 |
* @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
|
34 |
*/
|
35 |
class Doctrine_Schema_Relation extends Doctrine_Schema_Object
|
36 |
{
|
37 |
|
38 |
/**
|
39 |
* Column that refers to another table
|
40 |
* @access public
|
41 |
*/
|
42 |
public $referencingColumn;
|
43 |
|
44 |
/**
|
45 |
* Column that is referred from another table
|
46 |
* @access public
|
47 |
*/
|
48 |
public $referencedColumn;
|
49 |
|
50 |
/**
|
51 |
* Table where the referred column lives
|
52 |
* @access public
|
53 |
*
|
54 |
*/
|
55 |
public $referencedTable;
|
56 |
|
57 |
/**
|
58 |
* ON UPDATE or ON DELETE action
|
59 |
* @static
|
60 |
* @access public
|
61 |
*/
|
62 |
public static $ACTION_RESTRICT = 1;
|
63 |
|
64 |
/**
|
65 |
* ON UPDATE or ON DELETE action
|
66 |
* @static
|
67 |
* @access public
|
68 |
*/
|
69 |
public static $ACTION_SET_NULL = 2;
|
70 |
|
71 |
/**
|
72 |
* ON UPDATE or ON DELETE action
|
73 |
* @static
|
74 |
* @access public
|
75 |
*/
|
76 |
public static $ACTION_CASCADE = 3;
|
77 |
|
78 |
/**
|
79 |
* ON UPDATE or ON DELETE action
|
80 |
* @static
|
81 |
* @access public
|
82 |
*/
|
83 |
public static $ACTION_NO_ACTION = 4;
|
84 |
|
85 |
/**
|
86 |
* ON UPDATE or ON DELETE action
|
87 |
* @static
|
88 |
* @access public
|
89 |
*/
|
90 |
public static $ACTION_SET_DEFAULT = 5;
|
91 |
|
92 |
/**
|
93 |
*
|
94 |
* @param Doctrine_Schema_Column referencing
|
95 |
* @param Doctrine_Schema_Table referencedtable
|
96 |
* @param Doctrine_Schema_Column referencedColumn
|
97 |
* @return
|
98 |
* @access public
|
99 |
*/
|
100 |
public function setRelationBetween( $referencingColumn, $referencedTable, $referencedColumn )
|
101 |
{
|
102 |
$this->referencingColumn = $referencingColumn;
|
103 |
$this->referencedTable = $referencedTable;
|
104 |
$this->referencedColumn = $referencedColumn;
|
105 |
}
|
106 |
/**
|
107 |
* @return string
|
108 |
*/
|
109 |
public function __toString( )
|
110 |
{
|
111 |
return "Relation between '".$this->referencingColumn."' and '".$this->referencedTable."'.'".$this->referencingColumn."'";
|
112 |
}
|
113 |
/**
|
114 |
*
|
115 |
* @return bool
|
116 |
*/
|
117 |
public function isValid( )
|
118 |
{
|
119 |
|
120 |
}
|
121 |
}
|