Ticket #3530: sfFormDoctrine_isNew.diff
| File sfFormDoctrine_isNew.diff, 1.4 kB (added by thomas.s, 8 months ago) |
|---|
-
/Users/thomas/Workspace/erfahrung/symfony11/plugins/sfDoctrinePlugin/lib/sfFormDoctrine.class.php
old new 57 57 } 58 58 59 59 $this->object = $object; 60 $this->isNew = $this->object->exists();61 60 } 62 61 63 62 parent::__construct(array(), $options, $CSRFSecret); … … 87 86 */ 88 87 public function isNew() 89 88 { 90 return $this->object->exists();89 return !$this->object->exists(); 91 90 } 92 91 93 92 /** … … 306 305 protected function updateDefaultsFromObject() 307 306 { 308 307 // update defaults for the main object 309 if ($this->isNew )308 if ($this->isNew()) 310 309 { 311 310 $this->setDefaults(array_merge($this->object->toArray(BasePeer::TYPE_FIELDNAME), $this->getDefaults())); 312 311 } … … 321 320 $method = sprintf('getCurrent%s', $this->getI18nModelName()); 322 321 foreach ($this->cultures as $culture) 323 322 { 324 if ($this->isNew )323 if ($this->isNew()) 325 324 { 326 325 $this->setDefault($culture, array_merge($this->object->$method($culture)->toArray(BasePeer::TYPE_FIELDNAME), $this->getDefault($culture))); 327 326 }