Exemplo n.º 1
0
 public function executeAjaxAddPassenger(sfWebRequest $request)
 {
     // see if there is airport exist with this name
     $airport_name = $request->getParameter('airportname');
     $airport = AirportPeer::getBySpecificAirportName($airport_name);
     // If there is no airport then insert it into airport table
     if (!$airport) {
         //@TODO SET DEFAULT AIRPORT VALUE E
         $airport = new Airport();
         $airport->setName($airport_name);
         $airport->save();
     }
     $camp_passenger = new CampPassenger();
     $camp_passenger->setCampId($request->getParameter('camp'));
     $camp_passenger->setPassengerId($request->getParameter('passenger'));
     $camp_passenger->setAirportId($airport->getId());
     if (CampPassengerPeer::doCount($camp_passenger->buildCriteria())) {
         return $this->renderText('Passenger has already been added!');
     }
     $camp_passenger->setNote($request->getParameter('note'));
     if ($camp_passenger->save()) {
         return $this->renderText($airport->getId());
     }
     return $this->renderText('wrong');
 }
Exemplo n.º 2
0
 /**
  * Declares an association between this object and a Airport object.
  *
  * @param      Airport $v
  * @return     Camp The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setAirport(Airport $v = null)
 {
     if ($v === null) {
         $this->setAirportId(NULL);
     } else {
         $this->setAirportId($v->getId());
     }
     $this->aAirport = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Airport object, it will not be re-added.
     if ($v !== null) {
         $v->addCamp($this);
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * 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      Airport $value A Airport object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Airport $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }