示例#1
0
 public function executeDelete(sfWebRequest $request)
 {
     $type = $request->getParameter('type');
     $id = $request->getParameter('id');
     $c = new Criteria();
     try {
         if ($type == "brand") {
             BrandPeer::doDelete($c->add(BrandPeer::ID, $id));
         }
         if ($type == "series") {
             SeriesPeer::doDelete($c->add(SeriesPeer::ID, $id));
         }
         if ($type == "model") {
             ModelPeer::doDelete($c->add(ModelPeer::ID, $id));
         }
         if ($type == "config") {
             ConfigPeer::doDelete($c->add(ConfigPeer::ID, $id));
         }
         $this->res = "OK";
     } catch (Exception $exc) {
         $this->res = $exc->getMessage();
     }
 }
示例#2
0
文件: BaseBrand.php 项目: kotow/work
 public function delete($con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(BrandPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         BrandPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
示例#3
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      PropelPDO $con
  * @return     void
  * @throws     PropelException
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(BrandPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $ret = $this->preDelete($con);
         // symfony_behaviors behavior
         foreach (sfMixer::getCallables('BaseBrand:delete:pre') as $callable) {
             if (call_user_func($callable, $this, $con)) {
                 $con->commit();
                 return;
             }
         }
         if ($ret) {
             BrandPeer::doDelete($this, $con);
             $this->postDelete($con);
             // symfony_behaviors behavior
             foreach (sfMixer::getCallables('BaseBrand:delete:post') as $callable) {
                 call_user_func($callable, $this, $con);
             }
             $this->setDeleted(true);
             $con->commit();
         } else {
             $con->commit();
         }
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }