Development

Changeset 7845

You must first sign up to be able to contribute.

Changeset 7845

Show
Ignore:
Timestamp:
03/12/08 23:36:14 (1 year ago)
Author:
fabien
Message:

fixed sfFormPropel does not respect Propel inheritance (closes #2822)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/sfFormPropel.class.php

    r7275 r7845  
    4242  public function __construct(BaseObject $object = null, $options = array(), $CSRFSecret = null) 
    4343  { 
     44    $class = $this->getModelName(); 
    4445    if (is_null($object)) 
    4546    { 
    46       $class = $this->getModelName(); 
    4747      $this->object = new $class(); 
    4848    } 
    4949    else 
    5050    { 
    51       if ($this->getModelName() != get_class($object)
     51      if (!$object instanceof $class
    5252      { 
    53         throw new sfException(sprintf('The "%s" form only accepts a "%s" object.', get_class($this), $this->getModelName())); 
     53        throw new sfException(sprintf('The "%s" form only accepts a "%s" object.', get_class($this), $class)); 
    5454      } 
    5555 
     
    7171  { 
    7272    return Propel::getConnection(constant(sprintf('%sPeer::DATABASE_NAME', $this->getModelName()))); 
     73    return Propel::getConnection(constant(sprintf('%s::DATABASE_NAME', get_class($this->object->getPeer())))); 
    7374  } 
    7475 

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.