Changeset 4285
- Timestamp:
- 04/21/08 23:38:18 (15 months ago)
- Files:
-
- 1 modified
-
branches/0.11/lib/Doctrine/Data/Import.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Data/Import.php
r4284 r4285 156 156 * @param Doctrine_Record $record 157 157 * @param string $relationName 158 * @param string $referringRowKey 158 159 * @return Doctrine_Record 159 160 * @throws Doctrine_Data_Exception 160 161 */ 161 protected function _getImportedObject($rowKey, Doctrine_Record $record, $relationName )162 protected function _getImportedObject($rowKey, Doctrine_Record $record, $relationName, $referringRowKey) 162 163 { 163 164 if ( ! isset($this->_importedObjects[$rowKey])) { … … 171 172 if ( ! is_subclass_of($relatedRowKeyObject, $relation->getClass())) { 172 173 throw new Doctrine_Data_Exception(sprintf( 173 'Class referred to i s expected to be "%s" and "%s" was given',174 get_class($relatedRowKeyObject), $relation->getClass()));174 'Class referred to in "%s" is expected to be "%s" and "%s" was given', 175 $referringRowKey, $relation->getClass(), get_class($relatedRowKeyObject))); 175 176 } 176 177 } … … 201 202 foreach ($value as $link) { 202 203 if ($obj->getTable()->getRelation($key)->getType() === Doctrine_Relation::ONE) { 203 $obj->set($key, $this->_getImportedObject($link, $obj, $key ));204 $obj->set($key, $this->_getImportedObject($link, $obj, $key, $rowKey)); 204 205 } else if ($obj->getTable()->getRelation($key)->getType() === Doctrine_Relation::MANY) { 205 206 $relation = $obj->$key; 206 207 207 $relation[] = $this->_getImportedObject($link, $obj, $key );208 $relation[] = $this->_getImportedObject($link, $obj, $key, $rowKey); 208 209 } 209 210 } … … 212 213 } 213 214 } else { 214 $obj->set($key, $this->_getImportedObject($value, $obj, $key ));215 $obj->set($key, $this->_getImportedObject($value, $obj, $key, $rowKey)); 215 216 } 216 217 } else {