Example #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);
 }
Example #2
0
 public function addAdditionalGuestRelatedByChildGuestId(AdditionalGuest $l)
 {
     $this->collAdditionalGuestsRelatedByChildGuestId[] = $l;
     $l->setGuestRelatedByChildGuestId($this);
 }
Example #3
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();
     }
 }