Commit 43369bb4 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 2e6e9d6d
...@@ -145,6 +145,10 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -145,6 +145,10 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
* -- collation * -- collation
* *
* -- index the index definitions of this table * -- index the index definitions of this table
*
* -- treeImpl the tree implementation of this table (if any)
*
* -- treeOptions the tree options
*/ */
protected $options = array('name' => null, protected $options = array('name' => null,
'tableName' => null, 'tableName' => null,
...@@ -154,6 +158,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -154,6 +158,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
'engine' => null, 'engine' => null,
'charset' => null, 'charset' => null,
'collation' => null, 'collation' => null,
'treeImpl' => null,
'treeOptions' => null,
'index' => array(), 'index' => array(),
); );
...@@ -825,13 +831,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -825,13 +831,14 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
if (isset($this->bound[$name])) { if (isset($this->bound[$name])) {
$type = $this->bound[$name][1]; $type = $this->bound[$name][1];
$local = $this->bound[$name][2]; $local = $this->bound[$name][2];
list($component, $foreign) = explode(".",$this->bound[$name][0]); list($component, $foreign) = explode(".", $this->bound[$name][0]);
$alias = $name; $alias = $name;
$name = $this->bound[$alias][3]; $name = $this->bound[$alias][3];
$table = $this->conn->getTable($name); $table = $this->conn->getTable($name);
if ($component == $this->options['name'] || in_array($component, $this->parents)) { if ($component == $this->options['name'] || in_array($component, $this->parents)) {
// ONE-TO-ONE // ONE-TO-ONE
if ($type == Doctrine_Relation::ONE_COMPOSITE || if ($type == Doctrine_Relation::ONE_COMPOSITE ||
$type == Doctrine_Relation::ONE_AGGREGATE) { $type == Doctrine_Relation::ONE_AGGREGATE) {
...@@ -856,7 +863,6 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -856,7 +863,6 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
} elseif ($component == $name || } elseif ($component == $name ||
($component == $alias)) { // && ($name == $this->options['name'] || in_array($name,$this->parents)) ($component == $alias)) { // && ($name == $this->options['name'] || in_array($name,$this->parents))
if ( ! isset($local)) { if ( ! isset($local)) {
$local = $this->identifier; $local = $this->identifier;
} }
...@@ -867,8 +873,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -867,8 +873,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
// MANY-TO-MANY // MANY-TO-MANY
// only aggregate relations allowed // only aggregate relations allowed
if ($type != Doctrine_Relation::MANY_AGGREGATE) if ($type != Doctrine_Relation::MANY_AGGREGATE) {
throw new Doctrine_Table_Exception("Only aggregate relations are allowed for many-to-many relations"); throw new Doctrine_Table_Exception("Only aggregate relations are allowed for many-to-many relations");
}
$classes = array_merge($this->parents, array($this->options['name'])); $classes = array_merge($this->parents, array($this->options['name']));
...@@ -899,7 +906,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -899,7 +906,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
$relation = new Doctrine_Relation_Association_Self($table, $associationTable, $fields[0], $fields[1], $type, $alias); $relation = new Doctrine_Relation_Association_Self($table, $associationTable, $fields[0], $fields[1], $type, $alias);
} else { } else {
if($table === $this) {
} else {
// auto initialize a new one-to-one relationship for association table // auto initialize a new one-to-one relationship for association table
$associationTable->bind($this->getComponentName(), $associationTable->getComponentName(). '.' .$e2[1], Doctrine_Relation::ONE_AGGREGATE, $this->getIdentifier()); $associationTable->bind($this->getComponentName(), $associationTable->getComponentName(). '.' .$e2[1], Doctrine_Relation::ONE_AGGREGATE, $this->getIdentifier());
$associationTable->bind($table->getComponentName(), $associationTable->getComponentName(). '.' .$foreign, Doctrine_Relation::ONE_AGGREGATE, $table->getIdentifier()); $associationTable->bind($table->getComponentName(), $associationTable->getComponentName(). '.' .$foreign, Doctrine_Relation::ONE_AGGREGATE, $table->getIdentifier());
...@@ -909,7 +918,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable ...@@ -909,7 +918,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
$relation = new Doctrine_Relation_Association($table, $associationTable, $e2[1], $foreign, $type, $alias); $relation = new Doctrine_Relation_Association($table, $associationTable, $e2[1], $foreign, $type, $alias);
} }
}
} }
$this->relations[$alias] = $relation; $this->relations[$alias] = $relation;
......
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