public function save(Doctrine_Connection $conn = null) { $modified_fields = $this->getModified(); if (array_key_exists('filename', $modified_fields) && $this->old_locations) { // file name change, ok rename it foreach ($this->old_locations as $old_location) { if (!is_file($old_location)) { continue; } rename($old_location, $this->getFullPath()); } $this->old_locations = null; } if (array_key_exists('folder_id', $modified_fields)) { $this->move(); } if (is_array($this->binary_data)) { $this->createAsset($this->binary_data['tmp_name'], true); } if ($this->binary_data instanceof sfValidatedFile) { $this->createAsset($this->binary_data->getTempName(), true); } if (!$this->getFilename()) { return; } parent::save($conn); }