1
0
mirror of synced 2024-12-14 07:06:04 +03:00
This commit is contained in:
zYne 2007-08-03 11:24:45 +00:00
parent ab76c18fd7
commit da1a6e38a9
2 changed files with 23 additions and 23 deletions

View File

@ -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
*

View File

@ -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;
}
}