public function delete($con = null) { try { $con = Propel::getConnection(); $con->begin(); //deletes generic document $genericDocument = Document::getGenericDocument($this); $genericDocument->delete(); parent::delete(); $con->commit(); Document::deleteObjCache($this); return true; } catch (Exception $e) { $con->rollback(); throw $e; } }
/** * Wrapper for BaseMenu::getPath() call to allow additional functionality * option 'resolveAlias' - resolve aliases into full path * option 'getUrl' - resolve path to internal or external URL * * @param array $options Optional parameters * @return string Path or url for menu */ public function getPath($options = array()) { $aliases = array('%profile%' => sfContext::getInstance()->routing->generate(null, array('module' => 'user', 'slug' => sfContext::getInstance()->user->getUserSlug())), '%currentId%' => sfContext::getInstance()->request->id, '%currentSlug%' => @sfContext::getInstance()->request->getAttribute('sf_route')->resource->slug); $path = parent::offsetGet('path', $options); if (isset($options['resolveAlias']) && $options['resolveAlias']) { foreach ($aliases as $alias => $target) { if (false !== strpos($path, $alias)) { $path = str_replace($alias, $target, $path); } } } if (isset($options['getUrl']) && true == $options['getUrl']) { // Catch any exceptions thrown from url_for() to prevent ugly errors when // admin puts in a bad route try { $url = url_for($path); } catch (Exception $e) { // if exception caught then return a blank route (home page) $url = url_for(''); } $path = $url; } return $path; }
/** * 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 MenuPeer */ public function getPeer() { if (self::$peer === null) { self::$peer = new MenuPeer(); } return self::$peer; }
/** * Inits the Top Navigation by adding some default items */ public function init() { parent::init(); }