Ejemplo n.º 1
0
 public function delete($con = null)
 {
     foreach (sfMixer::getCallables('BaseStar:delete:pre') as $callable) {
         $ret = call_user_func($callable, $this, $con);
         if ($ret) {
             return;
         }
     }
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(StarPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         StarPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
     foreach (sfMixer::getCallables('BaseStar:delete:post') as $callable) {
         call_user_func($callable, $this, $con);
     }
 }
 /**
  * Deletes all stars for a Starred object
  * 
  * @param  BaseObject  $object
  */
 public function preDelete(BaseObject $object)
 {
     try {
         $c = new Criteria();
         $c->add(StarPeer::STARRED_MODEL, get_class($object));
         $c->add(StarPeer::STARRED_ID, $object->getPrimaryKey());
         StarPeer::doDelete($c);
     } catch (Exception $e) {
         throw new sfException('Unable to delete starred object related records');
     }
 }