This commit is contained in:
parent
714a42239b
commit
0686aef2c0
@ -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;
|
||||
}
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user