/**
  * Saves modified object data to the datastore.
  * If object is saved without left/right values, set them as undefined (0)
  *
  * @param      PropelPDO Connection to use.
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  *                 May be unreliable with parent/children/brother changes
  * @throws     PropelException
  */
 public function save(PropelPDO $con = null)
 {
     $left = $this->getLeftValue();
     $right = $this->getRightValue();
     if (empty($left) || empty($right)) {
         $root = sfAssetFolderPeer::retrieveRoot($this->getScopeIdValue(), $con);
         sfAssetFolderPeer::insertAsLastChildOf($this, $root, $con);
     }
     return parent::save($con);
 }
 /**
  * @param  Doctrine_Connection $con
  * @return integer
  */
 public function save(Doctrine_Connection $con = null)
 {
     $this->updateRelitevePath();
     return parent::save($con);
 }
 public function save(Doctrine_Connection $conn = null)
 {
     $exists = $this->exists();
     parent::save($conn);
     if (!is_null($this->old_path) && $exists) {
         $this->rename();
         $this->old_path = null;
     }
 }
Ejemplo n.º 4
0
 public function save($con = null)
 {
     if (!$this->isColumnModified(sfAssetFolderPeer::RELATIVE_PATH)) {
         if ($this->getParent()) {
             $this->setRelativePath($this->getParent()->getRelativePath() . '/' . $this->getName());
         } else {
             $this->setRelativePath($this->getName());
         }
     }
     // physical existence
     if (!$this->exists()) {
         if (!$this->create()) {
             throw new sfAssetException('Impossible to create folder "%name%"', array('%name%' => $this->getRelativePath()));
         }
     }
     return parent::save($con);
 }