Development

Changeset 5839

You must first sign up to be able to contribute.

Changeset 5839

Show
Ignore:
Timestamp:
11/04/07 15:22:05 (2 years 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
  • trunk/lib/plugins/sfPropelPlugin/lib/propel/sfPropelData.class.php

    r5340 r5839  
    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 
     
    124129          } 
    125130 
    126           $pos = array_search($name, $column_names); 
    127           $method = 'set'.sfInflector::camelize($name); 
    128           if ($pos) 
     131          if (false !== $pos = array_search($name, $column_names)) 
    129132          { 
    130133            $obj->setByPosition($pos, $value); 
    131134          } 
    132           else if (is_callable(array($obj, $method))) 
     135          else if (is_callable(array($obj, $method = 'set'.sfInflector::camelize($name)))) 
    133136          { 
    134137            $obj->$method($value); 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.