public function updateObject($values = null) { parent::updateObject($values); if (is_null($values)) { $values = $this->values; } $values = $this->processValues($values); if ($values['file_id'] instanceof sfValidatedFile) { if (!$this->isNew()) { unset($this->getObject()->File); } $file = new File(); $file->setFromValidatedFile($values['file_id']); $this->getObject()->setFile($file); } else { if (!$this->isNew() && !empty($values['file_id_delete'])) { $old = $this->getObject()->getCoverImage(); $this->getObject()->setFile(null); $this->getObject()->save(); $old->delete(); } } return $this->getObject(); }
protected function doSave($con = null) { parent::doSave($con); $this->getObject()->updateFileId(); }