Esempio n. 1
0
 public static function deleteByObject(BaseObject $object)
 {
     $c = new Criteria();
     $c->add(sfApprovalPeer::APPROVABLE_ID, $object->getPrimaryKey());
     $c->add(sfApprovalPeer::APPROVABLE_MODEL, get_class($object));
     $approval = sfApprovalPeer::doDelete($c);
 }
Esempio n. 2
0
 public function delete($con = null)
 {
     foreach (sfMixer::getCallables('BasesfApproval: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(sfApprovalPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         sfApprovalPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
     foreach (sfMixer::getCallables('BasesfApproval:delete:post') as $callable) {
         call_user_func($callable, $this, $con);
     }
 }