Make Doctrine_Collection objects use Doctrine::ATTR_COLL_KEY for data array keys
This commit is contained in:
parent
716bcedd76
commit
0b78afa97d
@ -91,6 +91,10 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
||||
$keyColumn = $table->getBoundQueryPart('indexBy');
|
||||
}
|
||||
|
||||
if ($keyColumn === null) {
|
||||
$keyColumn = $table->getAttribute(Doctrine::ATTR_COLL_KEY);
|
||||
}
|
||||
|
||||
if ($keyColumn !== null) {
|
||||
$this->keyColumn = $keyColumn;
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
if ( ! ($this instanceof Doctrine_Table)) {
|
||||
throw new Doctrine_Exception("This attribute can only be set at table level.");
|
||||
}
|
||||
if ($value !== null && ! $this->hasColumn($value)) {
|
||||
throw new Doctrine_Exception("Couldn't set collection key attribute. No such column '$value'");
|
||||
if ($value !== null && ! $this->hasField($value)) {
|
||||
throw new Doctrine_Exception("Couldn't set collection key attribute. No such field '$value'");
|
||||
}
|
||||
break;
|
||||
case Doctrine::ATTR_CACHE:
|
||||
|
Loading…
Reference in New Issue
Block a user