/**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aLeasingSpecialist instanceof Persistent) {
             $this->aLeasingSpecialist->clearAllReferences($deep);
         }
         if ($this->aLeasingAppointments instanceof Persistent) {
             $this->aLeasingAppointments->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aLeasingSpecialist = null;
     $this->aLeasingAppointments = null;
 }
 /**
  * @param	LeasingAppointments $leasingAppointments The leasingAppointments object to add.
  */
 protected function doAddLeasingAppointments($leasingAppointments)
 {
     $this->collLeasingAppointmentss[] = $leasingAppointments;
     $leasingAppointments->setLeasingAppointmentLeads($this);
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param LeasingAppointments $obj A LeasingAppointments object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         LeasingAppointmentsPeer::$instances[$key] = $obj;
     }
 }
 public function saveAppointmentRequestAction()
 {
     $request = $this->getRequest();
     $postid = $request->request->get('unitid');
     $date = $request->request->get('date');
     $time = $request->request->get('time');
     $leasePeriod = $request->request->get('leasePeriod');
     $targetMoveIn = $request->request->get('targetMoveIn');
     $fname = $request->request->get('fname');
     $lname = $request->request->get('lname');
     $contact = $request->request->get('contact');
     $email = $request->request->get('email');
     $country = LeasingCountryPeer::getIdByCountryName($request->request->get('country'));
     $nationality = LeasingNationalityPeer::getIdByNationalityName($request->request->get('nationality'));
     $notes = $request->request->get('notes');
     $clientIp = $request->request->get('clientIp');
     $firstHeard = $request->request->get('firstHeard');
     //UNIT DETAILS
     $unit = LeasingUnitPeer::getUnitByPostId($postid);
     $lead = new LeasingAppointmentLeads();
     $lead->setFname($fname);
     $lead->setLname($lname);
     $lead->setEmail($email);
     $lead->setMobile($contact);
     $lead->setCountryId($country->getId());
     $lead->setNationalityId($nationality->getId());
     $lead->setClientIp($clientIp);
     $lead->save();
     $now = new \DateTime('now');
     $app = new LeasingAppointments();
     $app->setAppointmentLeadsId($lead->getId());
     $app->setUnitId($unit->getId());
     $app->setPreferredDate($date);
     $app->setPreferredTime($time);
     $app->setLeasePeriod($leasePeriod);
     $app->setTargetMoveIn($targetMoveIn);
     $app->setFirstHeard($firstHeard);
     $app->setNotes($notes);
     $app->setDateAdded($now->format(C::DATETIMEFORMAT));
     $app->setStatus(C::PENDING);
     $app->setPrevStatus(C::PENDING);
     $app->save();
     $tl1 = new LeasingTimelineActivity();
     $tl1->setLeadTypeId(C::APPOINTMENT);
     $tl1->setLeadId($lead->getId());
     $tl1->setUser('Lead');
     $tl1->setActivity('Requested Unit Viewing');
     $tl1->setTimestamp($now->format(C::DATETIMEFORMAT));
     $tl1->setStatus('Pending');
     $tl1->setStatusId(C::PENDING);
     $tl1->save();
     $this->get('session')->set('thank-you', 1);
     $client = new GlobeClient();
     $msg = "Thank you, " . $lead->getFname() . " " . $lead->getLname() . "! Your request to view " . $app->getLeasingUnit()->getName() . " is now being processed. We will update you ASAP once an agent is assigned to assist you. This msg is FREE.";
     $sms = $client->sms($this->globeShortCode);
     $response = $sms->sendMessage($lead->getMobile(), $msg, $this->appId, $this->appSecret);
     if ($response && !isset($response['error'])) {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(11);
         $badge->setLeadTypeId(C::APPOINTMENT);
         $badge->setLeadId($lead->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl2 = new LeasingTimelineActivity();
         $tl2->setLeadTypeId(C::APPOINTMENT);
         $tl2->setLeadId($lead->getId());
         $tl2->setUser('System');
         $tl2->setActivity('Verified mobile number');
         $tl2->setTimestamp($now->format(C::DATETIMEFORMAT));
         $tl2->setStatus('Mobile Verified');
         $tl2->setStatusId(C::MOBILE_VERIFIED);
         $tl2->save();
     }
     $ve = VerifyEmail::verifyThisEmail($lead->getEmail());
     if ($ve = 'valid') {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(12);
         $badge->setLeadTypeId(C::PARKING);
         $badge->setLeadId($lead->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl3 = new LeasingTimelineActivity();
         $tl3->setLeadTypeId(C::PARKING);
         $tl3->setLeadId($lead->getId());
         $tl3->setUser('System');
         $tl3->setActivity('Verified email address');
         $tl3->setTimestamp($now->format(C::DATETIMEFORMAT));
         $tl3->setStatus('Email Verified');
         $tl3->setStatusId(C::EMAIL_VERIFIED);
         $tl3->save();
     }
     echo 1;
     exit;
     return new Response();
 }
 /**
  * Exclude object from result
  *
  * @param   LeasingAppointments $leasingAppointments Object to remove from the list of results
  *
  * @return LeasingAppointmentsQuery The current query, for fluid interface
  */
 public function prune($leasingAppointments = null)
 {
     if ($leasingAppointments) {
         $this->addUsingAlias(LeasingAppointmentsPeer::ID, $leasingAppointments->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Filter the query by a related LeasingAppointments object
  *
  * @param   LeasingAppointments|PropelObjectCollection $leasingAppointments The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 LeasingAppointmentAssignmentQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByLeasingAppointments($leasingAppointments, $comparison = null)
 {
     if ($leasingAppointments instanceof LeasingAppointments) {
         return $this->addUsingAlias(LeasingAppointmentAssignmentPeer::APPOINTMENTS_ID, $leasingAppointments->getId(), $comparison);
     } elseif ($leasingAppointments instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(LeasingAppointmentAssignmentPeer::APPOINTMENTS_ID, $leasingAppointments->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByLeasingAppointments() only accepts arguments of type LeasingAppointments or PropelCollection');
     }
 }
 /**
  * Filter the query by a related LeasingAppointments object
  *
  * @param   LeasingAppointments|PropelObjectCollection $leasingAppointments  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 LeasingAppointmentLeadsQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByLeasingAppointments($leasingAppointments, $comparison = null)
 {
     if ($leasingAppointments instanceof LeasingAppointments) {
         return $this->addUsingAlias(LeasingAppointmentLeadsPeer::ID, $leasingAppointments->getAppointmentLeadsId(), $comparison);
     } elseif ($leasingAppointments instanceof PropelObjectCollection) {
         return $this->useLeasingAppointmentsQuery()->filterByPrimaryKeys($leasingAppointments->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByLeasingAppointments() only accepts arguments of type LeasingAppointments or PropelCollection');
     }
 }