/** * 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; }
/** * Get the associated MissionLeg object * * @param PropelPDO Optional Connection object. * @return MissionLeg The associated MissionLeg object. * @throws PropelException */ public function getMissionLeg(PropelPDO $con = null) { if ($this->aMissionLeg === null && $this->leg_id !== null) { $c = new Criteria(MissionLegPeer::DATABASE_NAME); $c->add(MissionLegPeer::ID, $this->leg_id); $this->aMissionLeg = MissionLegPeer::doSelectOne($c, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aMissionLeg->addMissionPhotos($this); */ } return $this->aMissionLeg; }
private function _setAutoLegCancelled($camp_airport_id, $airport_id, $mission_id, $type = 'source') { $c = new Criteria(); if ($type == 'source') { $c->add(MissionLegPeer::FROM_AIRPORT_ID, $airport_id); $c->add(MissionLegPeer::TO_AIRPORT_ID, $camp_airport_id); } else { $c->add(MissionLegPeer::FROM_AIRPORT_ID, $camp_airport_id); $c->add(MissionLegPeer::TO_AIRPORT_ID, $airport_id); } $c->add(MissionLegPeer::MISSION_ID, $mission_id); $c->add(MissionLegPeer::LEG_NUMBER, 1); $leg = MissionLegPeer::doSelectOne($c); if ($leg) { //print_r($leg);exit; $leg->setCancelMissionLeg(0); $leg->save(); } else { //echo 'nai';exit; } }
/** * Get the associated MissionLeg object * * @param PropelPDO Optional Connection object. * @return MissionLeg The associated MissionLeg object. * @throws PropelException */ public function getMissionLeg(PropelPDO $con = null) { if ($this->aMissionLeg === null && $this->id !== null) { $c = new Criteria(MissionLegPeer::DATABASE_NAME); $c->add(MissionLegPeer::ID, $this->id); $this->aMissionLeg = MissionLegPeer::doSelectOne($c, $con); // Because this foreign key represents a one-to-one relationship, we will create a bi-directional association. $this->aMissionLeg->setAfaLeg($this); } return $this->aMissionLeg; }