Beispiel #1
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EtimeRsvpPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setEtimeId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setRsvpId($arr[$keys[1]]);
     }
 }
Beispiel #2
0
 public function getEtimeRsvpsJoinRsvp($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseEtimeRsvpPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEtimeRsvps === null) {
         if ($this->isNew()) {
             $this->collEtimeRsvps = array();
         } else {
             $criteria->add(EtimeRsvpPeer::ETIME_ID, $this->getId());
             $this->collEtimeRsvps = EtimeRsvpPeer::doSelectJoinRsvp($criteria, $con);
         }
     } else {
         $criteria->add(EtimeRsvpPeer::ETIME_ID, $this->getId());
         if (!isset($this->lastEtimeRsvpCriteria) || !$this->lastEtimeRsvpCriteria->equals($criteria)) {
             $this->collEtimeRsvps = EtimeRsvpPeer::doSelectJoinRsvp($criteria, $con);
         }
     }
     $this->lastEtimeRsvpCriteria = $criteria;
     return $this->collEtimeRsvps;
 }
Beispiel #3
0
 public static function retrieveByPK($etime_id, $rsvp_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(EtimeRsvpPeer::ETIME_ID, $etime_id);
     $criteria->add(EtimeRsvpPeer::RSVP_ID, $rsvp_id);
     $v = EtimeRsvpPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Beispiel #4
0
 public function executeCreate()
 {
     if ($this->getRequest()->getMethod() != sfRequest::POST) {
         $this->event = new Event();
         $this->etime = new Etime();
         $this->forward404Unless($this->event);
         $this->forward404Unless($this->etime);
     } else {
         $event = new Event();
         $etime = new Etime();
         $event->setTitle($this->getRequestParameter('title'));
         $event->setStatusId($this->getRequestParameter('status_id') ? $this->getRequestParameter('status_id') : null);
         $event->setCategoryId($this->getRequestParameter('category_id') ? $this->getRequestParameter('category_id') : null);
         $event->setPublished($this->getRequestParameter('published', 0));
         $event->setMediaPotential($this->getRequestParameter('media_potential', 0));
         $event->setDescription($this->getRequestParameter('description'));
         $event->setNotes($this->getRequestParameter('notes'));
         $event->setImageUrl($this->getRequestParameter('image_url'));
         //      $event->setOrganiser($this->getRequestParameter('organiser'));
         //      $event->setInterestedParties($this->getRequestParameter('interested_parties'));
         $event->save();
         $etime->setEventId($event->getId());
         $etime->setTitle($this->getRequestParameter('etime_title'));
         $etime->setStartDate(strtotime($this->getRequestParameter('start_date') . ' ' . $this->getRequestParameter('start_date_time')));
         $etime->setEndDate(strtotime($this->getRequestParameter('end_date') . ' ' . $this->getRequestParameter('end_date_time')));
         $etime->setAllDay($this->getRequestParameter('all_day') ? $this->getRequestParameter('all_day') : false);
         $etime->setLocation($this->getRequestParameter('location'));
         $etime->setDescription($this->getRequestParameter('etime_description'));
         $etime->setNotes($this->getRequestParameter('etime_notes'));
         $etime->setCapacity($this->getRequestParameter('capacity') ? $this->getRequestParameter('capacity') : null);
         $etime->setAdditionalGuests($this->getRequestParameter('additional_guests') ? $this->getRequestParameter('additional_guests') : 0);
         $etime->setHasFee($this->getRequestParameter('has_fee') ? $this->getRequestParameter('has_fee') : false);
         $etime->setAudioVisualSupport($this->getRequestParameter('audio_visual_support') ? $this->getRequestParameter('audio_visual_support') : false);
         //      $etime->setOrganiser($this->getRequestParameter('etime_organiser'));
         //      $etime->setInterestedParties($this->getRequestParameter('etime_interested_parties'));
         $etime->save();
         // Update many-to-many for "etime_rsvp"
         $c = new Criteria();
         $c->add(EtimeRsvpPeer::ETIME_ID, $etime->getPrimaryKey());
         EtimeRsvpPeer::doDelete($c);
         $ids = $this->getRequestParameter('associated_etime_rsvp');
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $EtimeRsvp = new EtimeRsvp();
                 $EtimeRsvp->setEtime($etime);
                 $EtimeRsvp->setRsvpId($id);
                 $EtimeRsvp->save();
             }
         }
         // Update many-to-many for "etime_audience"
         $c = new Criteria();
         $c->add(EtimeAudiencePeer::ETIME_ID, $etime->getPrimaryKey());
         EtimeAudiencePeer::doDelete($c);
         $ids = $this->getRequestParameter('associated_etime_audience');
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $EtimeAudience = new EtimeAudience();
                 $EtimeAudience->setEtime($etime);
                 $EtimeAudience->setAudienceId($id);
                 $EtimeAudience->save();
             }
         }
         if ($this->getRequestParameter('tag_string')) {
             TagTools::recordTags($this->getRequestParameter('tag_string'), "event", $event);
         }
         if ($this->getRequestParameter('etime_tag_string')) {
             TagTools::recordTags($this->getRequestParameter('etime_tag_string'), "etime", $etime);
         }
         return $this->redirect('@show_event?slug=' . $event->getSlug());
     }
     return sfView::SUCCESS;
 }