Commit 0b78afa9 authored by adamthehutt's avatar adamthehutt

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

parent 716bcedd
......@@ -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:
......
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