Development

Changeset 5843

You must first sign up to be able to contribute.

Changeset 5843

Show
Ignore:
Timestamp:
11/04/07 16:21:15 (1 year ago)
Author:
fabien
Message:

added an exception message when trying to use a non Propel class with sfPropelData::load() method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/addon/propel/sfPropelData.class.php

    r5339 r5843  
    9999        $obj = new $class(); 
    100100 
     101        if (!$obj instanceof BaseObject) 
     102        { 
     103          throw new Exception(sprintf('The class "%s" is not a Propel class. This probably means there is already a class named "%s" somewhere in symfony or in your project.', $class, $class)); 
     104        } 
     105 
    101106        if (!is_array($data)) 
    102107        { 
    103           throw new Exception(sprintf('You must give a name for each fixture data entry (class %s)'), $class); 
     108          throw new Exception(sprintf('You must give a name for each fixture data entry (class %s)', $class)); 
    104109        } 
    105110 
     
    126131          } 
    127132 
    128           $pos = array_search($name, $column_names); 
    129           $method = 'set'.sfInflector::camelize($name); 
    130           if ($pos) 
     133          if (false !== $pos = array_search($name, $column_names)) 
    131134          { 
    132135            $obj->setByPosition($pos, $value); 
    133136          } 
    134           else if (is_callable(array($obj, $method))) 
     137          else if (is_callable(array($obj, $method = 'set'.sfInflector::camelize($name)))) 
    135138          { 
    136139            $obj->$method($value);