1
0
mirror of synced 2025-01-18 06:21:40 +03:00
This commit is contained in:
zYne 2007-08-13 21:39:29 +00:00
parent 714a42239b
commit 0686aef2c0

View File

@ -205,6 +205,13 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
// create database table
if (method_exists($record, 'setTableDefinition')) {
$record->setTableDefinition();
// get the declaring class of setTableDefinition method
$method = new ReflectionMethod($this->options['name'], 'setTableDefinition');
$class = $method->getDeclaringClass();
} else {
$class = new ReflectionClass($class);
}
$this->options['declaringClass'] = $class;
// set the table definition for the given tree implementation
if ($this->isTree()) {
@ -213,16 +220,10 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
$this->columnCount = count($this->columns);
if (isset($this->columns)) {
// get the declaring class of setTableDefinition method
$method = new ReflectionMethod($this->options['name'], 'setTableDefinition');
$class = $method->getDeclaringClass();
$this->options['declaringClass'] = $class;
if ( ! isset($this->options['tableName'])) {
$this->options['tableName'] = Doctrine::tableize($class->getName());
}
switch (count($this->primaryKeys)) {
case 0:
$this->columns = array_merge(array('id' =>
@ -283,10 +284,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
}
}
}
}
} else {
throw new Doctrine_Table_Exception("Class '$name' has no table definition.");
}
$record->setUp();
@ -895,7 +893,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
public function findAll()
{
$graph = new Doctrine_Query($this->conn);
$users = $graph->query("FROM ".$this->options['name']);
$users = $graph->query('FROM ' . $this->options['name']);
return $users;
}
/**