示例#1
0
 /**
  * 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 = sfBreadNavPeer::retrieveRoot($this->getScopeIdValue(), $con);
         sfBreadNavPeer::insertAsLastChildOf($this, $root, $con);
     }
     return parent::save($con);
 }
 /**
  * Delete root node
  *
  * @param      PropelPDO $con	Connection to use.
  * @return     boolean		Deletion status
  */
 public static function deleteRoot($scopeId = null, PropelPDO $con = null)
 {
     if (!self::SCOPE_COL) {
         $scopeId = null;
     }
     $root = sfBreadNavPeer::retrieveRoot($scopeId, $con);
     if (sfBreadNavPeer::getNumberOfChildren($root) == 1) {
         return sfBreadNavPeer::deleteNode($root, $con);
     } else {
         return false;
     }
 }