Source of file ConstraintObject.php
Size: 7,037 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Db/Metadata/Object/ConstraintObject.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Db\Metadata\Object; class ConstraintObject { /** * * @var string */ protected $name = null; /** * * @var string */ protected $tableName = null; /** * * @var string */ protected $schemaName = null; /** * One of "PRIMARY KEY", "UNIQUE", "FOREIGN KEY", or "CHECK" * * @var string */ protected $type = null; /** * * * @var string[] */ protected $columns = array(); /** * * * @var string */ protected $referencedTableSchema; /** * * * @var string */ protected $referencedTableName; /** * * * @var string[] */ protected $referencedColumns; /** * * * @var string */ protected $matchOption; /** * * * @var string */ protected $updateRule; /** * * * @var string */ protected $deleteRule; /** * * * @var string */ protected $checkClause; /** * Constructor * * @param string $name * @param string $tableName * @param string $schemaName */ public function __construct($name, $tableName, $schemaName = null) { $this->setName($name); $this->setTableName($tableName); $this->setSchemaName($schemaName); } /** * Set name * * @param string $name */ public function setName($name) { $this->name = $name; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set schema name * * @param string $schemaName */ public function setSchemaName($schemaName) { $this->schemaName = $schemaName; } /** * Get schema name * * @return string */ public function getSchemaName() { return $this->schemaName; } /** * Get table name * * @return string */ public function getTableName() { return $this->tableName; } /** * Set table name * * @param string $tableName * @return ConstraintObject */ public function setTableName($tableName) { $this->tableName = $tableName; return $this; } /** * Set type * * @param string $type */ public function setType($type) { $this->type = $type; } /** * Get type * * @return string */ public function getType() { return $this->type; } public function hasColumns() { return (!empty($this->columns)); } /** * Get Columns. * * @return string[] */ public function getColumns() { return $this->columns; } /** * Set Columns. * * @param string[] $columns * @return ConstraintObject */ public function setColumns(array $columns) { $this->columns = $columns; return $this; } /** * Get Referenced Table Schema. * * @return string */ public function getReferencedTableSchema() { return $this->referencedTableSchema; } /** * Set Referenced Table Schema. * * @param string $referencedTableSchema * @return ConstraintObject */ public function setReferencedTableSchema($referencedTableSchema) { $this->referencedTableSchema = $referencedTableSchema; return $this; } /** * Get Referenced Table Name. * * @return string */ public function getReferencedTableName() { return $this->referencedTableName; } /** * Set Referenced Table Name. * * @param string $referencedTableName * @return ConstraintObject */ public function setReferencedTableName($referencedTableName) { $this->referencedTableName = $referencedTableName; return $this; } /** * Get Referenced Columns. * * @return string[] */ public function getReferencedColumns() { return $this->referencedColumns; } /** * Set Referenced Columns. * * @param string[] $referencedColumns * @return ConstraintObject */ public function setReferencedColumns(array $referencedColumns) { $this->referencedColumns = $referencedColumns; return $this; } /** * Get Match Option. * * @return string */ public function getMatchOption() { return $this->matchOption; } /** * Set Match Option. * * @param string $matchOption * @return ConstraintObject */ public function setMatchOption($matchOption) { $this->matchOption = $matchOption; return $this; } /** * Get Update Rule. * * @return string */ public function getUpdateRule() { return $this->updateRule; } /** * Set Update Rule. * * @param string $updateRule * @return ConstraintObject */ public function setUpdateRule($updateRule) { $this->updateRule = $updateRule; return $this; } /** * Get Delete Rule. * * @return string */ public function getDeleteRule() { return $this->deleteRule; } /** * Set Delete Rule. * * @param string $deleteRule * @return ConstraintObject */ public function setDeleteRule($deleteRule) { $this->deleteRule = $deleteRule; return $this; } /** * Get Check Clause. * * @return string */ public function getCheckClause() { return $this->checkClause; } /** * Set Check Clause. * * @param string $checkClause * @return ConstraintObject */ public function setCheckClause($checkClause) { $this->checkClause = $checkClause; return $this; } /** * Is primary key * * @return bool */ public function isPrimaryKey() { return ('PRIMARY KEY' == $this->type); } /** * Is unique key * * @return bool */ public function isUnique() { return ('UNIQUE' == $this->type); } /** * Is foreign key * * @return bool */ public function isForeignKey() { return ('FOREIGN KEY' == $this->type); } /** * Is foreign key * * @return bool */ public function isCheck() { return ('CHECK' == $this->type); } } |