diff --git a/lib/Doctrine/Collection.php b/lib/Doctrine/Collection.php index 1d23a226a..8c46d6b2e 100644 --- a/lib/Doctrine/Collection.php +++ b/lib/Doctrine/Collection.php @@ -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; } diff --git a/lib/Doctrine/Configurable.php b/lib/Doctrine/Configurable.php index 1be3e4697..52165834d 100644 --- a/lib/Doctrine/Configurable.php +++ b/lib/Doctrine/Configurable.php @@ -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: