/**
  * Selects a collection of LeasingEventBookings objects pre-filled with all related objects except LeasingEventLeads.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return array           Array of LeasingEventBookings objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptLeasingEventLeads(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(LeasingEventBookingsPeer::DATABASE_NAME);
     }
     LeasingEventBookingsPeer::addSelectColumns($criteria);
     $startcol2 = LeasingEventBookingsPeer::NUM_HYDRATE_COLUMNS;
     LeasingEventPlacePeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + LeasingEventPlacePeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(LeasingEventBookingsPeer::EVENT_PLACE_ID, LeasingEventPlacePeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = LeasingEventBookingsPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = LeasingEventBookingsPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = LeasingEventBookingsPeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             LeasingEventBookingsPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined LeasingEventPlace rows
         $key2 = LeasingEventPlacePeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = LeasingEventPlacePeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = LeasingEventPlacePeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 LeasingEventPlacePeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (LeasingEventBookings) to the collection in $obj2 (LeasingEventPlace)
             $obj2->addLeasingEventBookings($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return                 LeasingEventPlace A model object, or null if the key is not found
  * @throws PropelException
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `id`, `name`, `post_id`, `slug`, `content`, `short_address`, `full_address`, `contact`, `email`, `min`, `max`, `reservation_fee`, `security_deposit` FROM `event_place` WHERE `id` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new LeasingEventPlace();
         $obj->hydrate($row);
         LeasingEventPlacePeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Пример #3
0
 public function saveEventAction()
 {
     $request = $this->getRequest();
     $ep = LeasingEventPlacePeer::getEventPlaceByPostId($request->request->get('post_id'));
     if (empty($ep)) {
         $ep = new LeasingEventPlace();
     }
     $ep->setName($request->request->get('name'));
     $ep->setPostId($request->request->get('post_id'));
     $ep->setContent($request->request->get('content'));
     $ep->setShortAddress($request->request->get('short_address'));
     $ep->setFullAddress($request->request->get('full_address'));
     $ep->setContact($request->request->get('contact'));
     $ep->setEmail($request->request->get('email'));
     $ep->save();
     return new RedirectResponse('http://leasing.dmcihomes.com.local/wp-admin/post.php');
 }
Пример #4
0
 public function saveEventBookingAction()
 {
     $request = $this->getRequest();
     $directory = $request->server->get('DOCUMENT_ROOT') . '/secured/uploads/events/';
     $files = $request->files->get('documents');
     $salutation = $request->request->get('salutation');
     $fname = $request->request->get('fname');
     $lname = $request->request->get('lname');
     $gender = $request->request->get('gender');
     $age = $request->request->get('age');
     $email = $request->request->get('email');
     $mobile = $request->request->get('mobile');
     $tmpbdate = $request->request->get('bdate');
     $bdate = new \DateTime($tmpbdate);
     $tmpEventDate = $request->request->get('eventDate');
     $eventDate = new \DateTime($tmpEventDate);
     $eventTimeFrom = $request->request->get('eventTimeFrom');
     $eventTimeTo = $request->request->get('eventTimeTo');
     $eventPostId = $request->request->get('postId');
     $eventSpecific = $request->request->get('eventSpecific');
     $firstHeard = $request->request->get('firstHeard');
     $date = new \DateTime('now');
     $eventPlace = LeasingEventPlacePeer::getEventPlaceByPostId($eventPostId);
     $eventLead = new LeasingEventLeads();
     $eventLead->setFname($fname);
     $eventLead->setLname($lname);
     $eventLead->setBirthdate($bdate->format('Y-m-d'));
     $eventLead->setAge($age);
     $eventLead->setGender($gender);
     $eventLead->setMobile($mobile);
     $eventLead->setEmail($email);
     $eventLead->setEventLeadType(1);
     $eventLead->save();
     $eventBooking = new LeasingEventBookings();
     $eventBooking->setEventPlaceId($eventPlace->getId());
     $eventBooking->setEventPlaceSpecific($eventSpecific);
     $eventBooking->setEventLeadsId($eventLead->getId());
     $eventBooking->setEventDate($eventDate->format('Y-m-d'));
     $eventBooking->setEventStartTime($eventTimeFrom);
     $eventBooking->setEventEndTime($eventTimeTo);
     $eventBooking->setDateAdded($date->format(C::DATETIMEFORMAT));
     $eventBooking->setFirstHeard($firstHeard);
     $eventBooking->setStatus(C::PENDING);
     $eventBooking->setPrevStatus(C::PENDING);
     $eventBooking->save();
     $code = 'EV' . U::generateCode(5, $eventBooking->getId());
     $eventBooking->setApplicationNumber($code);
     $eventBooking->save();
     $tl1 = new LeasingTimelineActivity();
     $tl1->setLeadTypeId(C::EVENT);
     $tl1->setLeadId($eventBooking->getId());
     $tl1->setUser('Lead');
     $tl1->setActivity('Requested for Event Space Rental');
     $tl1->setTimestamp($date->format(C::DATETIMEFORMAT));
     $tl1->setStatus('Pending');
     $tl1->setStatusId(C::PENDING);
     $tl1->save();
     foreach ($files as $file) {
         $tmp = $file->getPathName();
         $fileName = $eventBooking->getId() . '_' . $eventLead->getLname() . '_' . $eventBooking->getApplicationNumber() . '_' . $file->getClientOriginalName();
         $target = $directory . $fileName;
         if (move_uploaded_file($tmp, $target)) {
             $doc = new LeasingDocument();
             $doc->setDocument($fileName);
             $doc->save();
             $ld = new LeasingLeadDocument();
             $ld->setLeadId($eventBooking->getId());
             $ld->setDocumentId($doc->getId());
             $ld->setLeadTypeId(C::EVENT);
             $ld->save();
         } else {
             echo -2;
             exit;
         }
     }
     $this->get('session')->set('thank-you', 1);
     $client = new GlobeClient();
     $msg = "Thank you, " . $eventLead->getFname() . " " . $eventLead->getLname() . "! Your application reference number (ARN) is " . $eventBooking->getApplicationNumber() . ". We will update you ASAP once we've reviewed your application. You can check your status in this page, http://bit.ly/as12f. Log in with your last name and ARN. This msg is FREE.";
     $sms = $client->sms($this->globeShortCode);
     $response = $sms->sendMessage($eventLead->getMobile(), $msg, $this->appId, $this->appSecret);
     if ($response && !isset($response['error'])) {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(11);
         $badge->setLeadTypeId(C::EVENT);
         $badge->setLeadId($eventBooking->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl2 = new LeasingTimelineActivity();
         $tl2->setLeadTypeId(C::EVENT);
         $tl2->setLeadId($eventBooking->getId());
         $tl2->setUser('System');
         $tl2->setActivity('Verified mobile number');
         $tl2->setTimestamp($date->format(C::DATETIMEFORMAT));
         $tl2->setStatus('Mobile Verified');
         $tl2->setStatusId(C::MOBILE_VERIFIED);
         $tl2->save();
     }
     $ve = VerifyEmail::verifyThisEmail($eventLead->getEmail());
     if ($ve = 'valid') {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(12);
         $badge->setLeadTypeId(C::EVENT);
         $badge->setLeadId($eventBooking->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl3 = new LeasingTimelineActivity();
         $tl3->setLeadTypeId(C::EVENT);
         $tl3->setLeadId($eventBooking->getId());
         $tl3->setUser('System');
         $tl3->setActivity('Verified email address');
         $tl3->setTimestamp($date->format(C::DATETIMEFORMAT));
         $tl3->setStatus('Email Verified');
         $tl3->setStatusId(C::EMAIL_VERIFIED);
         $tl3->save();
     }
     echo 1;
     exit;
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @return LeasingEventPlace[]
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(LeasingEventPlacePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(LeasingEventPlacePeer::DATABASE_NAME);
         $criteria->add(LeasingEventPlacePeer::ID, $pks, Criteria::IN);
         $objs = LeasingEventPlacePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #6
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's BasePeer::TYPE_PHPNAME
  *
  * @param array  $arr     An array to populate the object from.
  * @param string $keyType The type of keys the array uses.
  * @return void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = LeasingEventPlacePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setPostId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setSlug($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setContent($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setShortAddress($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setFullAddress($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setContact($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setEmail($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setMin($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setMax($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setReservationFee($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setSecurityDeposit($arr[$keys[12]]);
     }
 }