[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * $Id: ForeignKeyInfo.php,v 1.9 2005/08/02 14:42:36 sethr Exp $ 5 * 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 7 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 8 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 9 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 10 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 11 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 12 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 13 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 14 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 16 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 * 18 * This software consists of voluntary contributions made by many individuals 19 * and is licensed under the LGPL. For more information please see 20 * <http://creole.phpdb.org>. 21 */ 22 23 /** 24 * Represents a foreign key. 25 * 26 * @author Hans Lellelid <hans@xmpl.org> 27 * @version $Revision: 1.9 $ 28 * @package creole.metadata 29 */ 30 class ForeignKeyInfo { 31 32 private $name; 33 private $references = array(); 34 35 /** 36 * Additional and optional vendor specific information. 37 * @var vendorSpecificInfo 38 */ 39 protected $vendorSpecificInfo = array(); 40 41 42 const NONE = ""; // No "ON [ DELETE | UPDATE]" behaviour specified. 43 const NOACTION = "NO ACTION"; 44 const CASCADE = "CASCADE"; 45 const RESTRICT = "RESTRICT"; 46 const SETDEFAULT = "SET DEFAULT"; 47 const SETNULL = "SET NULL"; 48 49 /** 50 * @param string $name The name of the foreign key. 51 */ 52 function __construct($name, $vendorInfo = array()) 53 { 54 $this->name = $name; 55 $this->vendorSpecificInfo = $vendorInfo; 56 } 57 58 /** 59 * Get foreign key name. 60 * @return string 61 */ 62 public function getName() 63 { 64 return $this->name; 65 } 66 67 /** 68 * Adds a foreign-local mapping. 69 * @param ColumnInfo $local 70 * @param ColumnInfo $foreign 71 */ 72 public function addReference(ColumnInfo $local, ColumnInfo $foreign, $onDelete = self::NONE, $onUpdate = self::NONE) 73 { 74 $this->references[] = array($local, $foreign, $onDelete, $onUpdate); 75 } 76 77 /** 78 * Gets the local-foreign column mapping. 79 * @return array array( [0] => array([0] => local ColumnInfo object, [1] => foreign ColumnInfo object, [2] => onDelete, [3] => onUpdate) ) 80 */ 81 public function getReferences() 82 { 83 return $this->references; 84 } 85 86 /** 87 * Get vendor specific optional information for this primary key. 88 * @return array vendorSpecificInfo[] 89 */ 90 public function getVendorSpecificInfo() 91 { 92 return $this->vendorSpecificInfo; 93 } 94 95 /** 96 * @return string 97 */ 98 public function toString() 99 { 100 return $this->name; 101 } 102 103 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |