Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow filter by location without limit to airport or city #441

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/samples/masterpricertravelboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1393,3 +1393,35 @@ It will returned both ADT and IIT fares for one passenger.
FareMasterPricerTbSearch::FLIGHTOPT_UNIFARES,
],
]);

Find by location without limit to airport or city
=================================================

If you want find by City and Airport at the same time, change the MPLocation type to «all»

.. code-block:: php

use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch;
use Amadeus\Client\RequestOptions\Fare\MPItinerary;
use Amadeus\Client\RequestOptions\Fare\MPLocation;
use Amadeus\Client\RequestOptions\Fare\MPPassenger;
use Amadeus\Client\RequestOptions\Fare\MPDate;

$opt = new FareMasterPricerTbSearch([
'nrOfRequestedPassengers' => 1,
'passengers' => [
new MPPassenger([
'type' => MPPassenger::TYPE_ADULT,
'count' => 1
]),
],
'itinerary' => [
new MPItinerary([
'departureLocation' => new MPLocation(['all' => 'MVD']),
'arrivalLocation' => new MPLocation(['all' => 'SAO']),
'date' => new MPDate([
'dateTime' => new \DateTime('2021-09-15T10:00:00+0000', new \DateTimeZone('UTC'))
]),
]),
],
]);
9 changes: 9 additions & 0 deletions src/Amadeus/Client/RequestOptions/Fare/MPLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ class MPLocation extends LoadParamsFromArray
*/
public $city;

/**
* City or Airport code
*
* Use ATA/IATA defined 3 letter city code
*
* @var string
*/
public $all;

/**
* List of one or more cities
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public function __construct(MPLocation $location)
} elseif (!empty($location->city)) {
$this->locationId = $location->city;
$this->airportCityQualifier = "C";
} elseif (!empty($location->all)) {
$this->locationId = $location->all;
}

if (!empty($location->longitude) && !empty($location->latitude)) {
Expand Down