Changeset 4346

Show
Ignore:
Timestamp:
05/10/08 01:07:20 (8 months ago)
Author:
jwage
Message:

Fixing issue where custom setter for data fixtures is only called for relations and not fields too. Changed to call custom setter if it is defined on the fixture Doctrine_Record.

Files:
1 modified

Legend:

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

    r4332 r4346  
    192192 
    193193        foreach ($row as $key => $value) { 
    194             if ($obj->getTable()->hasField($key)) { 
     194            if (method_exists($obj, 'set' . Doctrine_Inflector::classify($key))) { 
     195                $func = 'set' . Doctrine_Inflector::classify($key); 
     196                $obj->$func($value); 
     197            } else if ($obj->getTable()->hasField($key)) { 
    195198                $obj->set($key, $value); 
    196             } else if (method_exists($obj, 'set' . Doctrine_Inflector::classify($key))) { 
    197                     $func = 'set' . Doctrine_Inflector::classify($key); 
    198                     $obj->$func($value); 
    199199            } else if ($obj->getTable()->hasRelation($key)) { 
    200200                if (is_array($value)) {