コード例 #1
0
ファイル: PopInCampaignAction.php プロジェクト: bcbrr/PopIn
 protected function createOrUpdate(PopInCampaignEvent $event, PopInCampaign $model)
 {
     $con = Propel::getConnection(PopInCampaignTableMap::DATABASE_NAME);
     $con->beginTransaction();
     try {
         if (null !== ($id = $event->getId())) {
             $model->setId($id);
         }
         if (null !== ($start = $event->getStart())) {
             $model->setStart($start);
         }
         if (null !== ($end = $event->getEnd())) {
             $model->setEnd($end);
         }
         if (null !== ($contentSourceType = $event->getContentSourceType())) {
             $model->setContentSourceType($contentSourceType);
         }
         if (null !== ($contentSourceId = $event->getContentSourceId())) {
             $model->setContentSourceId($contentSourceId);
         }
         $model->save($con);
         $con->commit();
     } catch (\Exception $e) {
         $con->rollback();
         throw $e;
     }
     $event->setPopInCampaign($model);
 }
コード例 #2
0
ファイル: PopInCampaignAction.php プロジェクト: bcbrr/PopIn
 protected function createOrUpdate(PopInCampaignEvent $event, PopInCampaign $model)
 {
     $this->validateCampaignDates($event->getStart(), $event->getEnd());
     $this->validateContentSource($event->getContentSourceType(), $event->getContentSourceId());
     parent::createOrUpdate($event, $model);
 }