Development

#3530: sfFormDoctrine_isNew.diff

You must first sign up to be able to contribute.

Ticket #3530: sfFormDoctrine_isNew.diff

File sfFormDoctrine_isNew.diff, 1.4 kB (added by thomas.s, 8 months ago)

Use the function isNew() and return the correct value.

  • /Users/thomas/Workspace/erfahrung/symfony11/plugins/sfDoctrinePlugin/lib/sfFormDoctrine.class.php

    old new  
    5757      } 
    5858 
    5959      $this->object = $object; 
    60       $this->isNew = $this->object->exists(); 
    6160    } 
    6261 
    6362    parent::__construct(array(), $options, $CSRFSecret); 
     
    8786   */ 
    8887  public function isNew() 
    8988  { 
    90     return $this->object->exists(); 
     89    return !$this->object->exists(); 
    9190  } 
    9291 
    9392  /** 
     
    306305  protected function updateDefaultsFromObject() 
    307306  { 
    308307    // update defaults for the main object 
    309     if ($this->isNew
     308    if ($this->isNew()
    310309    { 
    311310      $this->setDefaults(array_merge($this->object->toArray(BasePeer::TYPE_FIELDNAME), $this->getDefaults())); 
    312311    } 
     
    321320      $method = sprintf('getCurrent%s', $this->getI18nModelName()); 
    322321      foreach ($this->cultures as $culture) 
    323322      { 
    324         if ($this->isNew
     323        if ($this->isNew()
    325324        { 
    326325          $this->setDefault($culture, array_merge($this->object->$method($culture)->toArray(BasePeer::TYPE_FIELDNAME), $this->getDefault($culture))); 
    327326        }