1
0
mirror of synced 2024-12-13 06:46:03 +03:00

Make Doctrine_Collection objects use Doctrine::ATTR_COLL_KEY for data array keys

This commit is contained in:
adamthehutt 2007-12-30 20:43:31 +00:00
parent 716bcedd76
commit 0b78afa97d
2 changed files with 6 additions and 2 deletions

View File

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

View File

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