/** * Retrieve object using using composite pkey values. * @param int $user_ride_id @param int $coord_order * @param PropelPDO $con * @return UserRideMap */ public static function retrieveByPK($user_ride_id, $coord_order, PropelPDO $con = null) { $key = serialize(array((string) $user_ride_id, (string) $coord_order)); if (null !== ($obj = UserRideMapPeer::getInstanceFromPool($key))) { return $obj; } if ($con === null) { $con = Propel::getConnection(UserRideMapPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(UserRideMapPeer::DATABASE_NAME); $criteria->add(UserRideMapPeer::USER_RIDE_ID, $user_ride_id); $criteria->add(UserRideMapPeer::COORD_ORDER, $coord_order); $v = UserRideMapPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
/** * Gets an array of UserRideMap 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 UserRides has previously been saved, it will retrieve * related UserRideMaps from storage. If this UserRides 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 UserRideMap[] * @throws PropelException */ public function getUserRideMaps($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(UserRidesPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collUserRideMaps === null) { if ($this->isNew()) { $this->collUserRideMaps = array(); } else { $criteria->add(UserRideMapPeer::USER_RIDE_ID, $this->user_ride_id); UserRideMapPeer::addSelectColumns($criteria); $this->collUserRideMaps = UserRideMapPeer::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(UserRideMapPeer::USER_RIDE_ID, $this->user_ride_id); UserRideMapPeer::addSelectColumns($criteria); if (!isset($this->lastUserRideMapCriteria) || !$this->lastUserRideMapCriteria->equals($criteria)) { $this->collUserRideMaps = UserRideMapPeer::doSelect($criteria, $con); } } } $this->lastUserRideMapCriteria = $criteria; return $this->collUserRideMaps; }
public function executeElevation() { $userId = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', null, 'subscriber'); $this->elevationChart = null; $rideId = $this->getRequestParameter('rideId'); //sfContext::getInstance()->getLogger()->info('$$$$$$$$CHARTRIDEID '.$rideId); if ($rideId) { //sfContext::getInstance()->getLogger()->info('$$$$$$$$CHARTRIDEID have rideId'); //get all of the map points and make sure we have lat/long $c = new Criteria(); $c->add(UserRideMapPeer::USER_RIDE_ID, $rideId); $mapPoints = UserRideMapPeer::doSelect($c); if ($mapPoints) { // sfContext::getInstance()->getLogger()->info('$$$$$$$$CHARTRIDEID have mapPoints'); foreach ($mapPoints as $mp) { // sfContext::getInstance()->getLogger()->info('$$$$$$$$CHARTRIDEID have point'); if (!$mp->getElevation()) { // sfContext::getInstance()->getLogger()->info('$$$$$$$$CHARTRIDEID no elevation'); $mp->setElevation($this->lookupElevation($mp->getLat(), $mp->getLong())); $mp->save(); } } $this->elevationChart = $this->createElevationGraph($userId, $rideId); } } }