Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Db / Metadata / Object / ConstraintObject.php
blob655dd974ed7b937a71a142e8779fa682b32b89ec
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Db\Metadata\Object;
12 class ConstraintObject
14 /**
16 * @var string
18 protected $name = null;
20 /**
22 * @var string
24 protected $tableName = null;
26 /**
28 * @var string
30 protected $schemaName = null;
32 /**
33 * One of "PRIMARY KEY", "UNIQUE", "FOREIGN KEY", or "CHECK"
35 * @var string
37 protected $type = null;
39 /**
42 * @var string[]
44 protected $columns = array();
46 /**
49 * @var string
51 protected $referencedTableSchema;
53 /**
56 * @var string
58 protected $referencedTableName;
60 /**
63 * @var string[]
65 protected $referencedColumns;
67 /**
70 * @var string
72 protected $matchOption;
74 /**
77 * @var string
79 protected $updateRule;
81 /**
84 * @var string
86 protected $deleteRule;
88 /**
91 * @var string
93 protected $checkClause;
95 /**
96 * Constructor
98 * @param string $name
99 * @param string $tableName
100 * @param string $schemaName
102 public function __construct($name, $tableName, $schemaName = null)
104 $this->setName($name);
105 $this->setTableName($tableName);
106 $this->setSchemaName($schemaName);
110 * Set name
112 * @param string $name
114 public function setName($name)
116 $this->name = $name;
120 * Get name
122 * @return string
124 public function getName()
126 return $this->name;
130 * Set schema name
132 * @param string $schemaName
134 public function setSchemaName($schemaName)
136 $this->schemaName = $schemaName;
140 * Get schema name
142 * @return string
144 public function getSchemaName()
146 return $this->schemaName;
150 * Get table name
152 * @return string
154 public function getTableName()
156 return $this->tableName;
160 * Set table name
162 * @param string $tableName
163 * @return ConstraintObject
165 public function setTableName($tableName)
167 $this->tableName = $tableName;
168 return $this;
172 * Set type
174 * @param string $type
176 public function setType($type)
178 $this->type = $type;
182 * Get type
184 * @return string
186 public function getType()
188 return $this->type;
191 public function hasColumns()
193 return (!empty($this->columns));
197 * Get Columns.
199 * @return string[]
201 public function getColumns()
203 return $this->columns;
207 * Set Columns.
209 * @param string[] $columns
210 * @return ConstraintObject
212 public function setColumns(array $columns)
214 $this->columns = $columns;
215 return $this;
219 * Get Referenced Table Schema.
221 * @return string
223 public function getReferencedTableSchema()
225 return $this->referencedTableSchema;
229 * Set Referenced Table Schema.
231 * @param string $referencedTableSchema
232 * @return ConstraintObject
234 public function setReferencedTableSchema($referencedTableSchema)
236 $this->referencedTableSchema = $referencedTableSchema;
237 return $this;
241 * Get Referenced Table Name.
243 * @return string
245 public function getReferencedTableName()
247 return $this->referencedTableName;
251 * Set Referenced Table Name.
253 * @param string $referencedTableName
254 * @return ConstraintObject
256 public function setReferencedTableName($referencedTableName)
258 $this->referencedTableName = $referencedTableName;
259 return $this;
263 * Get Referenced Columns.
265 * @return string[]
267 public function getReferencedColumns()
269 return $this->referencedColumns;
273 * Set Referenced Columns.
275 * @param string[] $referencedColumns
276 * @return ConstraintObject
278 public function setReferencedColumns(array $referencedColumns)
280 $this->referencedColumns = $referencedColumns;
281 return $this;
285 * Get Match Option.
287 * @return string
289 public function getMatchOption()
291 return $this->matchOption;
295 * Set Match Option.
297 * @param string $matchOption
298 * @return ConstraintObject
300 public function setMatchOption($matchOption)
302 $this->matchOption = $matchOption;
303 return $this;
307 * Get Update Rule.
309 * @return string
311 public function getUpdateRule()
313 return $this->updateRule;
317 * Set Update Rule.
319 * @param string $updateRule
320 * @return ConstraintObject
322 public function setUpdateRule($updateRule)
324 $this->updateRule = $updateRule;
325 return $this;
329 * Get Delete Rule.
331 * @return string
333 public function getDeleteRule()
335 return $this->deleteRule;
339 * Set Delete Rule.
341 * @param string $deleteRule
342 * @return ConstraintObject
344 public function setDeleteRule($deleteRule)
346 $this->deleteRule = $deleteRule;
347 return $this;
351 * Get Check Clause.
353 * @return string
355 public function getCheckClause()
357 return $this->checkClause;
361 * Set Check Clause.
363 * @param string $checkClause
364 * @return ConstraintObject
366 public function setCheckClause($checkClause)
368 $this->checkClause = $checkClause;
369 return $this;
373 * Is primary key
375 * @return bool
377 public function isPrimaryKey()
379 return ('PRIMARY KEY' == $this->type);
383 * Is unique key
385 * @return bool
387 public function isUnique()
389 return ('UNIQUE' == $this->type);
393 * Is foreign key
395 * @return bool
397 public function isForeignKey()
399 return ('FOREIGN KEY' == $this->type);
403 * Is foreign key
405 * @return bool
407 public function isCheck()
409 return ('CHECK' == $this->type);