コード例 #1
0
 public static function deletePhotographer($photog)
 {
     $c1 = new Criteria();
     $c1->add(JobPhotographerPeer::PHOTOGRAPHER_ID, $photog->getId());
     JobPhotographerPeer::doDelete($c1);
     $photog->delete();
 }
コード例 #2
0
ファイル: Job.php プロジェクト: adatta02/comp190-code
 public function removePhotographer($photographer)
 {
     $c = new Criteria();
     $c->add(JobPhotographerPeer::JOB_ID, $this->getId());
     $c->add(JobPhotographerPeer::PHOTOGRAPHER_ID, $photographer->getId());
     JobPhotographerPeer::doDelete($c);
     $logEntry = new Log();
     $logEntry->setWhen(time());
     $logEntry->setPropelClass("Job");
     $logEntry->setSfGuardUserProfileId(sfContext::getInstance()->getUser()->getUserId());
     $logEntry->setMessage($photographer->getName() . " removed from job.");
     $logEntry->setLogMessageTypeId(sfConfig::get("app_log_type_remove_photographer"));
     $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('BaseJobPhotographer: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(JobPhotographerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         JobPhotographerPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     foreach (sfMixer::getCallables('BaseJobPhotographer:delete:post') as $callable) {
         call_user_func($callable, $this, $con);
     }
 }