Changeset 4285

Show
Ignore:
Timestamp:
04/21/08 23:38:18 (15 months ago)
Author:
jwage
Message:

Fixed error messagge in _getImportedObject() to be accurate and more complete.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Data/Import.php

    r4284 r4285  
    156156     * @param  Doctrine_Record $record 
    157157     * @param  string $relationName 
     158     * @param  string $referringRowKey 
    158159     * @return Doctrine_Record 
    159160     * @throws Doctrine_Data_Exception 
    160161     */ 
    161     protected function _getImportedObject($rowKey, Doctrine_Record $record, $relationName) 
     162    protected function _getImportedObject($rowKey, Doctrine_Record $record, $relationName, $referringRowKey) 
    162163    { 
    163164        if ( ! isset($this->_importedObjects[$rowKey])) { 
     
    171172            if ( ! is_subclass_of($relatedRowKeyObject, $relation->getClass())) { 
    172173                throw new Doctrine_Data_Exception(sprintf( 
    173                     'Class referred to is 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))); 
    175176            } 
    176177        } 
     
    201202                        foreach ($value as $link) { 
    202203                            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)); 
    204205                            } else if ($obj->getTable()->getRelation($key)->getType() === Doctrine_Relation::MANY) { 
    205206                                $relation = $obj->$key; 
    206207                                 
    207                                 $relation[] = $this->_getImportedObject($link, $obj, $key); 
     208                                $relation[] = $this->_getImportedObject($link, $obj, $key, $rowKey); 
    208209                            } 
    209210                        } 
     
    212213                    } 
    213214                } else { 
    214                     $obj->set($key, $this->_getImportedObject($value, $obj, $key)); 
     215                    $obj->set($key, $this->_getImportedObject($value, $obj, $key, $rowKey)); 
    215216                } 
    216217            } else {