Commit da1a6e38 authored by zYne's avatar zYne

--no commit message

--no commit message
parent ab76c18f
...@@ -1454,26 +1454,6 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count ...@@ -1454,26 +1454,6 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
return $this; 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 * used to delete node from tree - MUST BE USE TO DELETE RECORD IF TABLE ACTS AS TREE
* *
......
...@@ -96,14 +96,15 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access ...@@ -96,14 +96,15 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
$this->_table->setOption('inheritanceMap', $map); $this->_table->setOption('inheritanceMap', $map);
} }
public function setSubclasses($map){ public function setSubclasses($map)
if(isset($map[get_class($this)])){ {
if (isset($map[get_class($this)])){
$this->_table->setOption('inheritanceMap', $map[get_class($this)]); $this->_table->setOption('inheritanceMap', $map[get_class($this)]);
return; return;
} }
$this->_table->setOption('subclasses', array_keys($map)); $this->_table->setOption('subclasses', array_keys($map));
$conn = $this->_table->getConnection(); $conn = $this->_table->getConnection();
foreach($map as $key => $value){ foreach ($map as $key => $value) {
$table = $conn->getTable($key); $table = $conn->getTable($key);
// $table->setOption('inheritanceMap', $value); // $table->setOption('inheritanceMap', $value);
} }
...@@ -233,5 +234,24 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access ...@@ -233,5 +234,24 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
foreach ($definitions as $name => $options) { foreach ($definitions as $name => $options) {
$this->hasColumn($name, $options['type'], $options['length'], $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;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment