Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.3
-
Fix Version/s: None
-
Component/s: Record
-
Labels:None
Description
Using the following in the base class:
$this->setAttribute(Doctrine_Core::ATTR_COLL_KEY, 'class');
Then executing a query to array the indexes of the entity are not that of the class field:
example:
array( 0 => .. 1 => ... );
fix:
/**
* Populate a Doctrine_Collection from an array of data
*
* @param string $array
* @return void
*/
public function fromArray($array, $deep = true)
{
$data = array();
foreach ($array as $rowKey => $row) {
$this[$rowKey]->fromArray($row, $deep);
}
}
to
/**
* Populate a Doctrine_Collection from an array of data
*
* @param string $array
* @return void
*/
public function fromArray($array, $deep = true)
{
$data = array();
$keyColumn = $this->keyColumn;
foreach ($array as $rowKey => $row) {
$rowKey = $keyColumn AND isset($row[$keyColumn]) ? $row[$keyColumn] : $rowKey;
$this[$rowKey]->fromArray($row, $deep);
}
}