예제 #1
0
 public static function recordExists(AdditionalGuest $obj)
 {
     $c = new Criteria();
     $c->add(AdditionalGuestPeer::PARENT_GUEST_ID, $obj->getParentGuestId());
     $c->add(AdditionalGuestPeer::CHILD_GUEST_ID, $obj->getChildGuestId());
     return AdditionalGuestPeer::doCount($c);
 }
예제 #2
0
 public static function countAdditionalGuests($parent_id)
 {
     $c = new Criteria();
     $c->add(AdditionalGuestPeer::PARENT_GUEST_ID, $parent_id);
     return AdditionalGuestPeer::doCount($c);
 }
예제 #3
0
파일: BaseGuest.php 프로젝트: soon0009/EMS
 public function countAdditionalGuestsRelatedByChildGuestId($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BaseAdditionalGuestPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(AdditionalGuestPeer::CHILD_GUEST_ID, $this->getId());
     return AdditionalGuestPeer::doCount($criteria, $distinct, $con);
 }
예제 #4
0
 public function executeEdit()
 {
     $this->prepareDataForEdit();
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->updateGuestFromRequest();
         $this->saveGuest($this->guest);
         $ag = new AdditionalGuest();
         if ($this->getRequestParameter('parent_id')) {
             $ag->setParentGuestId($this->getRequestParameter('parent_id'));
         } else {
             $ag->setParentGuestId($this->guest->getId());
         }
         $ag->setChildGuestId($this->guest->getId());
         if (!AdditionalGuestPeer::recordExists($ag)) {
             $ag->save();
         }
         if ($this->parent_id) {
             $parent_id = $this->parent_id;
         } else {
             $parent_id = $this->guest->getId();
         }
         $this->setFlash('notice', 'Your registration has been saved');
         if ($this->getRequestParameter('save_and_add')) {
             return $this->redirect('guest/create?etime_id=' . $this->guest->getEtimeId());
         } else {
             if ($this->getRequestParameter('save_and_list')) {
                 return $this->redirect('guest/list');
             } else {
                 return $this->redirect('guest/edit?id=' . $this->guest->getId() . '&etime_id=' . $this->guest->getEtimeId());
             }
         }
     } else {
         $this->labels = $this->getLabels();
     }
 }
예제 #5
0
 public static function retrieveByPK($parent_guest_id, $child_guest_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(AdditionalGuestPeer::PARENT_GUEST_ID, $parent_guest_id);
     $criteria->add(AdditionalGuestPeer::CHILD_GUEST_ID, $child_guest_id);
     $v = AdditionalGuestPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }