Ejemplo n.º 1
0
 /**
  * Gets MissionLeg object which contain a foreign key that references this object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     MissionLeg
  * @throws     PropelException
  */
 public function getMissionLeg($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(MissionReportPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collMissionLeg === null) {
         if (!$this->isNew()) {
             $criteria->add(MissionLegPeer::MISSION_REPORT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             $this->collMissionLeg = MissionLegPeer::doSelectOne($criteria, $con);
         }
     }
     return $this->collMissionLegs;
 }
Ejemplo n.º 2
0
 /**
  * Gets an array of MissionLeg objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this MissionReport has previously been saved, it will retrieve
  * related MissionLegs from storage. If this MissionReport is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array MissionLeg[]
  * @throws     PropelException
  */
 public function getMissionLegs($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(MissionReportPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collMissionLegs === null) {
         if ($this->isNew()) {
             $this->collMissionLegs = array();
         } else {
             $criteria->add(MissionLegPeer::MISSION_REPORT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             $this->collMissionLegs = MissionLegPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(MissionLegPeer::MISSION_REPORT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             if (!isset($this->lastMissionLegCriteria) || !$this->lastMissionLegCriteria->equals($criteria)) {
                 $this->collMissionLegs = MissionLegPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastMissionLegCriteria = $criteria;
     return $this->collMissionLegs;
 }
Ejemplo n.º 3
0
 /**
  * Selects a collection of MissionPhoto objects pre-filled with all related objects except Mission.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of MissionPhoto objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptMission(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseMissionPhotoPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) {
         call_user_func($callable, 'BaseMissionPhotoPeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MissionPhotoPeer::addSelectColumns($c);
     $startcol2 = MissionPhotoPeer::NUM_COLUMNS - MissionPhotoPeer::NUM_LAZY_LOAD_COLUMNS;
     MissionLegPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (MissionLegPeer::NUM_COLUMNS - MissionLegPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(MissionPhotoPeer::LEG_ID), array(MissionLegPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MissionPhotoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MissionPhotoPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = MissionPhotoPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MissionPhotoPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined MissionLeg rows
         $key2 = MissionLegPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = MissionLegPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = MissionLegPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 MissionLegPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (MissionPhoto) to the collection in $obj2 (MissionLeg)
             $obj2->addMissionPhoto($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Ejemplo n.º 4
0
 public static function doSelectJoinCustom(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('MissionPeer:doSelectJoinCustom:doSelectJoinCustom') as $callable) {
         call_user_func($callable, 'MissionPeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MissionPeer::addSelectColumns($c);
     $startcol2 = MissionPeer::NUM_COLUMNS - MissionPeer::NUM_LAZY_LOAD_COLUMNS;
     ItineraryPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (ItineraryPeer::NUM_COLUMNS - ItineraryPeer::NUM_LAZY_LOAD_COLUMNS);
     MissionTypePeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (MissionTypePeer::NUM_COLUMNS - MissionTypePeer::NUM_LAZY_LOAD_COLUMNS);
     PassengerPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + (PassengerPeer::NUM_COLUMNS - PassengerPeer::NUM_LAZY_LOAD_COLUMNS);
     MissionLegPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + (MissionLegPeer::NUM_COLUMNS - MissionLegPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(MissionPeer::ITINERARY_ID), array(ItineraryPeer::ID), $join_behavior);
     $c->addJoin(array(MissionPeer::MISSION_TYPE_ID), array(MissionTypePeer::ID), $join_behavior);
     $c->addJoin(array(MissionPeer::PASSENGER_ID), array(PassengerPeer::ID), $join_behavior);
     $c->addJoin(array(MissionPeer::ID), array(MissionLegPeer::MISSION_ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MissionPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MissionPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = MissionPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MissionPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Itinerary rows
         $key2 = ItineraryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ItineraryPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = ItineraryPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ItineraryPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Mission) to the collection in $obj3 (Itinerary)
             $obj2->addMission($obj1);
         }
         // if joined row not null
         // Add objects for joined MissionType rows
         $key3 = MissionTypePeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = MissionTypePeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = MissionTypePeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 MissionTypePeer::addInstanceToPool($obj3, $key3);
             }
             // if obj3 loaded
             // Add the $obj1 (Mission) to the collection in $obj3 (MissionType)
             $obj3->addMission($obj1);
         }
         // if joined row not null
         // Add objects for joined Passenger rows
         $key4 = PassengerPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = PassengerPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $omClass = PassengerPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 PassengerPeer::addInstanceToPool($obj4, $key4);
             }
             // if obj4 loaded
             // Add the $obj1 (Mission) to the collection in $obj4 (Passenger)
             $obj4->addMission($obj1);
         }
         // if joined row not null
         // Add objects for joined MissionLeg rows
         $key5 = MissionLegPeer::getPrimaryKeyHashFromRow($row, $startcol5);
         if ($key5 !== null) {
             $obj5 = MissionLegPeer::getInstanceFromPool($key5);
             if (!$obj5) {
                 $omClass = MissionLegPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj5 = new $cls();
                 $obj5->hydrate($row, $startcol5);
                 MissionLegPeer::addInstanceToPool($obj5, $key5);
             }
             // if obj5 loaded
             // Add the $obj1 (Mission) to the collection in $obj5 (MissionLeg)
             $obj5->setMission($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Ejemplo n.º 5
0
 /**
  * Gets an array of MissionLeg objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this Member has previously been saved, it will retrieve
  * related MissionLegsRelatedByBackupCopilotId from storage. If this Member is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array MissionLeg[]
  * @throws     PropelException
  */
 public function getMissionLegsRelatedByBackupCopilotId($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(MemberPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collMissionLegsRelatedByBackupCopilotId === null) {
         if ($this->isNew()) {
             $this->collMissionLegsRelatedByBackupCopilotId = array();
         } else {
             $criteria->add(MissionLegPeer::BACKUP_COPILOT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             $this->collMissionLegsRelatedByBackupCopilotId = MissionLegPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(MissionLegPeer::BACKUP_COPILOT_ID, $this->id);
             MissionLegPeer::addSelectColumns($criteria);
             if (!isset($this->lastMissionLegRelatedByBackupCopilotIdCriteria) || !$this->lastMissionLegRelatedByBackupCopilotIdCriteria->equals($criteria)) {
                 $this->collMissionLegsRelatedByBackupCopilotId = MissionLegPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastMissionLegRelatedByBackupCopilotIdCriteria = $criteria;
     return $this->collMissionLegsRelatedByBackupCopilotId;
 }
Ejemplo n.º 6
0
 /**
  * Match according to personal flights of pilot
  * @param <type> $id
  * @param <type> $max
  * @param <type> $page
  * @return sfPropelPager
  */
 public static function getByFilterPF($id, $max = 10, $page = 1)
 {
     $personal_flight = PersonalFlightPeer::retrieveByPK($id);
     if (!$id or !isset($personal_flight)) {
         return null;
     }
     $c = new Criteria();
     $c->addAscendingOrderByColumn(self::MISSION_ID);
     $c->addJoin(self::MISSION_ID, MissionPeer::ID, Criteria::LEFT_JOIN);
     $c->addJoin(MissionPeer::MISSION_TYPE_ID, MissionTypePeer::ID, Criteria::LEFT_JOIN);
     $c->addJoin(self::ID, PilotRequestPeer::LEG_ID, Criteria::LEFT_JOIN);
     //airport
     $c->addAlias('c1', AirportPeer::TABLE_NAME);
     $c->addAlias('c2', AirportPeer::TABLE_NAME);
     $c->addJoin(self::FROM_AIRPORT_ID, AirportPeer::alias('c1', AirportPeer::ID), Criteria::LEFT_JOIN);
     $c->addJoin(self::TO_AIRPORT_ID, AirportPeer::alias('c2', AirportPeer::ID), Criteria::LEFT_JOIN);
     $criterion = $c->getNewCriterion(MissionPeer::MISSION_DATE, date('Y-m-d', strtotime($personal_flight->getDepartureDate())) . '%', Criteria::LIKE);
     $criterion->addAnd($c->getNewCriterion(AirportPeer::alias('c1', AirportPeer::CITY), '%' . $personal_flight->getOriginCity() . '%', Criteria::LIKE));
     $criterion->addAnd($c->getNewCriterion(AirportPeer::alias('c2', AirportPeer::CITY), '%' . $personal_flight->getDestinationCity() . '%', Criteria::LIKE));
     $criterion->addAnd($c->getNewCriterion(AirportPeer::alias('c1', AirportPeer::ZIPCODE), '%' . $personal_flight->getOriginZipcode() . '%', Criteria::LIKE));
     $criterion->addAnd($c->getNewCriterion(AirportPeer::alias('c2', AirportPeer::ZIPCODE), '%' . $personal_flight->getDestinationZipcode() . '%', Criteria::LIKE));
     $criterion2 = $c->getNewCriterion(AirportPeer::alias('c2', AirportPeer::CITY), $personal_flight->getOriginCity());
     $criterion2->addAnd($c->getNewCriterion(AirportPeer::alias('c1', AirportPeer::CITY), $personal_flight->getDestinationCity()));
     $criterion2->addAnd($c->getNewCriterion(MissionPeer::MISSION_DATE, date('Y-m-d', strtotime($personal_flight->getReturnDate())) . '%', Criteria::LIKE));
     $criterion2->addAnd($c->getNewCriterion(AirportPeer::alias('c2', AirportPeer::ZIPCODE), '%' . $personal_flight->getOriginZipcode() . '%', Criteria::LIKE));
     $criterion2->addAnd($c->getNewCriterion(AirportPeer::alias('c1', AirportPeer::ZIPCODE), '%' . $personal_flight->getDestinationZipcode() . '%', Criteria::LIKE));
     $criterion->addOr($criterion2);
     $c->add($criterion);
     $c->add(self::MISSION_REPORT_ID, null, Criteria::ISNULL);
     $c->add(PilotRequestPeer::PILOT_TYPE, 'Command Pilot', Criteria::NOT_EQUAL);
     $criterion = $c->getNewCriterion(PilotRequestPeer::PROCESSED, 0, Criteria::EQUAL);
     $criterion->addOr($c->getNewCriterion(PilotRequestPeer::ID, null, Criteria::ISNULL));
     $c->add($criterion);
     MissionLegPeer::addSelectColumns($c);
     /*
         $c->addAsColumn('distance', 'Round(ACos(Sin(Radians(c1.latitude)) * Sin(Radians(c2.latitude)) + Cos(Radians(c1.latitude)) * Cos(Radians(c2.latitude)) * Cos(Radians(c1.longitude)-Radians(c2.longitude))) * ((180*60)/3.1415),0)');
     
         //EFFECIENCY
         if ($home_base && $hb_airport = AirportPeer::retrieveByPK($home_base))
         {
               $c->addAsColumn('efficiency', "
               CEILING(ROUND(ACOS(SIN(RADIANS(c1.latitude))
               *SIN(RADIANS(c2.latitude))+COS(RADIANS(c1.latitude))
               *COS(RADIANS(c2.latitude))*COS(RADIANS(c1.longitude)-RADIANS(c2.longitude)))
               *((180*60)/PI()))/(ROUND(ACOS(SIN(RADIANS(c1.latitude))
               *SIN(RADIANS(c2.latitude))+COS(RADIANS(c1.latitude))
               *COS(RADIANS(c2.latitude))
               *
               COS(RADIANS(c1.longitude)-RADIANS(c2.longitude))
                 ) * ((180*60)/PI())
               )
               +
               ROUND(
                 ACOS(
                   SIN(RADIANS({$hb_airport->getLatitude()}))
                   *
                   SIN(RADIANS(c2.latitude))
                   +
                   COS(RADIANS({$hb_airport->getLatitude()}))
                   *
                   COS(RADIANS(c2.latitude))
                   *
                   COS(RADIANS({$hb_airport->getLongitude()})-RADIANS(c2.longitude))
                 ) * ((180*60)/PI())
               )
               +
               ROUND(
                 ACOS(
                   SIN(RADIANS({$hb_airport->getLatitude()}))
                   *
                   SIN(RADIANS(c1.latitude))
                   +
                   COS(RADIANS({$hb_airport->getLatitude()}))
                   *
                   COS(RADIANS(c1.latitude))
                   *
                   COS(RADIANS({$hb_airport->getLongitude()})-RADIANS(c1.longitude))
                 ) * ((180*60)/PI()))) * 200)");
     
           $c->addDescendingOrderByColumn('efficiency');
         }
     
         $c->addDescendingOrderByColumn('distance');
     */
     //    return self::doSelect($c);
     $pager = new sfPropelPager('MissionLeg', $max);
     $pager->setCriteria($c);
     $pager->setPage($page);
     $pager->init();
     return $pager;
 }
Ejemplo n.º 7
0
 /**
  * Selects a collection of MissionLeg objects pre-filled with all related objects except Fbo.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of MissionLeg objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptFbo(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MissionLegPeer::addSelectColumns($c);
     $startcol2 = MissionLegPeer::NUM_COLUMNS - MissionLegPeer::NUM_LAZY_LOAD_COLUMNS;
     MissionPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (MissionPeer::NUM_COLUMNS - MissionPeer::NUM_LAZY_LOAD_COLUMNS);
     AirportPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (AirportPeer::NUM_COLUMNS - AirportPeer::NUM_LAZY_LOAD_COLUMNS);
     AirportPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + (AirportPeer::NUM_COLUMNS - AirportPeer::NUM_LAZY_LOAD_COLUMNS);
     CoordinatorPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + (CoordinatorPeer::NUM_COLUMNS - CoordinatorPeer::NUM_LAZY_LOAD_COLUMNS);
     PilotPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + (PilotPeer::NUM_COLUMNS - PilotPeer::NUM_LAZY_LOAD_COLUMNS);
     MemberPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + (MemberPeer::NUM_COLUMNS - MemberPeer::NUM_LAZY_LOAD_COLUMNS);
     PilotPeer::addSelectColumns($c);
     $startcol9 = $startcol8 + (PilotPeer::NUM_COLUMNS - PilotPeer::NUM_LAZY_LOAD_COLUMNS);
     MemberPeer::addSelectColumns($c);
     $startcol10 = $startcol9 + (MemberPeer::NUM_COLUMNS - MemberPeer::NUM_LAZY_LOAD_COLUMNS);
     MissionReportPeer::addSelectColumns($c);
     $startcol11 = $startcol10 + (MissionReportPeer::NUM_COLUMNS - MissionReportPeer::NUM_LAZY_LOAD_COLUMNS);
     PilotAircraftPeer::addSelectColumns($c);
     $startcol12 = $startcol11 + (PilotAircraftPeer::NUM_COLUMNS - PilotAircraftPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(MissionLegPeer::MISSION_ID), array(MissionPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::FROM_AIRPORT_ID), array(AirportPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::TO_AIRPORT_ID), array(AirportPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::COORDINATOR_ID), array(CoordinatorPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::PILOT_ID), array(PilotPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::COPILOT_ID), array(MemberPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::BACKUP_PILOT_ID), array(PilotPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::BACKUP_COPILOT_ID), array(MemberPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::MISSION_REPORT_ID), array(MissionReportPeer::ID), $join_behavior);
     $c->addJoin(array(MissionLegPeer::PILOT_AIRCRAFT_ID), array(PilotAircraftPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MissionLegPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MissionLegPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = MissionLegPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MissionLegPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Mission rows
         $key2 = MissionPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = MissionPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = MissionPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 MissionPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj2 (Mission)
             $obj2->addMissionLeg($obj1);
         }
         // if joined row is not null
         // Add objects for joined Airport rows
         $key3 = AirportPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = AirportPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = AirportPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 AirportPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj3 (Airport)
             $obj3->addMissionLegRelatedByFromAirportId($obj1);
         }
         // if joined row is not null
         // Add objects for joined Airport rows
         $key4 = AirportPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = AirportPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $omClass = AirportPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 AirportPeer::addInstanceToPool($obj4, $key4);
             }
             // if $obj4 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj4 (Airport)
             $obj4->addMissionLegRelatedByToAirportId($obj1);
         }
         // if joined row is not null
         // Add objects for joined Coordinator rows
         $key5 = CoordinatorPeer::getPrimaryKeyHashFromRow($row, $startcol5);
         if ($key5 !== null) {
             $obj5 = CoordinatorPeer::getInstanceFromPool($key5);
             if (!$obj5) {
                 $omClass = CoordinatorPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj5 = new $cls();
                 $obj5->hydrate($row, $startcol5);
                 CoordinatorPeer::addInstanceToPool($obj5, $key5);
             }
             // if $obj5 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj5 (Coordinator)
             $obj5->addMissionLeg($obj1);
         }
         // if joined row is not null
         // Add objects for joined Pilot rows
         $key6 = PilotPeer::getPrimaryKeyHashFromRow($row, $startcol6);
         if ($key6 !== null) {
             $obj6 = PilotPeer::getInstanceFromPool($key6);
             if (!$obj6) {
                 $omClass = PilotPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj6 = new $cls();
                 $obj6->hydrate($row, $startcol6);
                 PilotPeer::addInstanceToPool($obj6, $key6);
             }
             // if $obj6 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj6 (Pilot)
             $obj6->addMissionLegRelatedByPilotId($obj1);
         }
         // if joined row is not null
         // Add objects for joined Member rows
         $key7 = MemberPeer::getPrimaryKeyHashFromRow($row, $startcol7);
         if ($key7 !== null) {
             $obj7 = MemberPeer::getInstanceFromPool($key7);
             if (!$obj7) {
                 $omClass = MemberPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj7 = new $cls();
                 $obj7->hydrate($row, $startcol7);
                 MemberPeer::addInstanceToPool($obj7, $key7);
             }
             // if $obj7 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj7 (Member)
             $obj7->addMissionLegRelatedByCopilotId($obj1);
         }
         // if joined row is not null
         // Add objects for joined Pilot rows
         $key8 = PilotPeer::getPrimaryKeyHashFromRow($row, $startcol8);
         if ($key8 !== null) {
             $obj8 = PilotPeer::getInstanceFromPool($key8);
             if (!$obj8) {
                 $omClass = PilotPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj8 = new $cls();
                 $obj8->hydrate($row, $startcol8);
                 PilotPeer::addInstanceToPool($obj8, $key8);
             }
             // if $obj8 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj8 (Pilot)
             $obj8->addMissionLegRelatedByBackupPilotId($obj1);
         }
         // if joined row is not null
         // Add objects for joined Member rows
         $key9 = MemberPeer::getPrimaryKeyHashFromRow($row, $startcol9);
         if ($key9 !== null) {
             $obj9 = MemberPeer::getInstanceFromPool($key9);
             if (!$obj9) {
                 $omClass = MemberPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj9 = new $cls();
                 $obj9->hydrate($row, $startcol9);
                 MemberPeer::addInstanceToPool($obj9, $key9);
             }
             // if $obj9 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj9 (Member)
             $obj9->addMissionLegRelatedByBackupCopilotId($obj1);
         }
         // if joined row is not null
         // Add objects for joined MissionReport rows
         $key10 = MissionReportPeer::getPrimaryKeyHashFromRow($row, $startcol10);
         if ($key10 !== null) {
             $obj10 = MissionReportPeer::getInstanceFromPool($key10);
             if (!$obj10) {
                 $omClass = MissionReportPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj10 = new $cls();
                 $obj10->hydrate($row, $startcol10);
                 MissionReportPeer::addInstanceToPool($obj10, $key10);
             }
             // if $obj10 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj10 (MissionReport)
             $obj10->addMissionLeg($obj1);
         }
         // if joined row is not null
         // Add objects for joined PilotAircraft rows
         $key11 = PilotAircraftPeer::getPrimaryKeyHashFromRow($row, $startcol11);
         if ($key11 !== null) {
             $obj11 = PilotAircraftPeer::getInstanceFromPool($key11);
             if (!$obj11) {
                 $omClass = PilotAircraftPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj11 = new $cls();
                 $obj11->hydrate($row, $startcol11);
                 PilotAircraftPeer::addInstanceToPool($obj11, $key11);
             }
             // if $obj11 already loaded
             // Add the $obj1 (MissionLeg) to the collection in $obj11 (PilotAircraft)
             $obj11->addMissionLeg($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }