diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index c3b19ea78..5696b84e4 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -1454,26 +1454,6 @@ 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 * diff --git a/lib/Doctrine/Record/Abstract.php b/lib/Doctrine/Record/Abstract.php index f628f6ce4..d6a2b53b0 100644 --- a/lib/Doctrine/Record/Abstract.php +++ b/lib/Doctrine/Record/Abstract.php @@ -96,14 +96,15 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access $this->_table->setOption('inheritanceMap', $map); } - public function setSubclasses($map){ - if(isset($map[get_class($this)])){ + public function setSubclasses($map) + { + if (isset($map[get_class($this)])){ $this->_table->setOption('inheritanceMap', $map[get_class($this)]); return; } $this->_table->setOption('subclasses', array_keys($map)); $conn = $this->_table->getConnection(); - foreach($map as $key => $value){ + foreach ($map as $key => $value) { $table = $conn->getTable($key); // $table->setOption('inheritanceMap', $value); } @@ -233,5 +234,24 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access foreach ($definitions as $name => $options) { $this->hasColumn($name, $options['type'], $options['length'], $options); } + } + /** + * 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; } }