Пример #1
0
     foreach ($trailRelationships as $trailRelationship) {
         $points[] = [Segment::getSegmentBySegmentId($pdo, $trailRelationship->getSegmentId())->getSegmentStart()->getY(), Segment::getSegmentBySegmentId($pdo, $trailRelationship->getSegmentId())->getSegmentStart()->getX()];
         $points[] = [Segment::getSegmentBySegmentId($pdo, $trailRelationship->getSegmentId())->getSegmentStop()->getY(), Segment::getSegmentBySegmentId($pdo, $trailRelationship->getSegmentId())->getSegmentStop()->getX()];
     }
     // Add segments to reply
     $reply->points = $points;
 } elseif (empty($userId) === false) {
     $reply->data = Trail::getTrailByUserId($pdo, $userId)->toArray();
 } elseif (empty($submitId) === false) {
     $reply->data = Trail::getTrailBySubmitTrailId($pdo, $submitId)->toArray();
 } elseif (empty($amenities) === false) {
     $reply->data = Trail::getTrailByTrailAmenities($pdo, $amenities)->toArray();
 } elseif (empty($condition) === false) {
     $reply->data = Trail::getTrailByTrailCondition($pdo, $condition)->toArray();
 } elseif (empty($description) === false) {
     $reply->data = Trail::getTrailByTrailDescription($pdo, $description)->toArray();
 } elseif (empty($difficulty) === false) {
     $reply->data = Trail::getTrailByTrailDifficulty($pdo, $difficulty)->toArray();
 } elseif (empty($distance) === false) {
     $reply->data = Trail::getTrailByTrailDistance($pdo, $distance)->toArray();
 } elseif (empty($name) === false) {
     $reply->data = Trail::getTrailByTrailName($pdo, $name)->toArray();
 } elseif (empty($submission) === false) {
     $reply->data = Trail::getTrailByTrailSubmissionType($pdo, $submission)->toArray();
 } elseif (empty($terrain) === false) {
     $reply->data = Trail::getTrailByTrailTerrain($pdo, $terrain)->toArray();
 } elseif (empty($traffic) === false) {
     $reply->data = Trail::getTrailByTrailTraffic($pdo, $traffic)->toArray();
 } elseif (empty($use) === false) {
     $reply->data = Trail::getTrailByTrailUse($pdo, $use)->toArray();
     //} elseif (empty($uuid) === false) {
Пример #2
0
 /**
  * test grabbing a Trail by TrailDescription that does not exist
  *
  * @expectedException PDOException
  **/
 public function testGetInvalidTrailByTrailDescription()
 {
     //grab a TrailDescription that does not exist
     $trail = Trail::getTrailByTrailDescription($this->getPDO(), "<script></script>");
     $this->assertNull($trail);
 }