diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index 3f87d59a8..440012513 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -1452,6 +1452,26 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count return $this; } + + /** + * check + * adds a check constraint + * + * @param mixed $constraint either a SQL constraint portion or an array of CHECK constraints + * @param string $name optional constraint name + * @return Doctrine_Record this object + */ + public function check($constraint, $name = null) + { + if (is_array($constraint)) { + foreach ($constraint as $name => $def) { + $this->_table->addCheckConstraint($def, $name); + } + } else { + $this->_table->addCheckConstraint($constraint, $name); + } + return $this; + } /** * used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE *