示例#1
0
 public static function deleteClient($client)
 {
     $c1 = new Criteria();
     $c1->add(JobClientPeer::CLIENT_ID, $client->getId());
     JobClientPeer::doDelete($c1);
     $client->delete();
 }
示例#2
0
 public function removeClient($client)
 {
     $c = new Criteria();
     $c->add(JobClientPeer::CLIENT_ID, $client->getId());
     $c->add(JobClientPeer::JOB_ID, $this->getId());
     JobClientPeer::doDelete($c);
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage($client->getName() . " removed from job.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_remove_client"));
     $logEntry->setPropelId($this->getId());
     $logEntry->save();
 }
示例#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)
 {
     foreach (sfMixer::getCallables('BaseJobClient: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(JobClientPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         JobClientPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     foreach (sfMixer::getCallables('BaseJobClient:delete:post') as $callable) {
         call_user_func($callable, $this, $con);
     }
 }