Example #1
0
 /**
  * @param  PropelPDO $con
  * @return boolean
  */
 public function delete(PropelPDO $con = null)
 {
     $success = $this->destroy();
     parent::delete($con);
     return $success;
 }
 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);
 }
Example #3
0
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     sfAssetPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new sfAssetPeer();
     }
     return self::$peer;
 }
 /**
  * @param  Doctrine_Connection $con
  * @return boolean
  */
 public function delete(Doctrine_Connection $con = null)
 {
     $success = $this->destroy();
     parent::delete($con);
     return $success;
 }