I'm trying to setup the hotelbeds API. Now I'm gettings the results I expect up till the point where I'm trying to apply a filter:
$rqData->destination = new Destination("PAR");
$occupancy = new Occupancy();
$occupancy->adults = 2;
$occupancy->children = 1;
$occupancy->rooms = 1;
$occupancy->paxes = [ new Pax(Pax::AD, 30, "Mike", "Doe"),
new Pax(Pax::AD, 27, "Jane", "Doe"),
new Pax(Pax::CH, 8, "Mack", "Doe")
];
$rqData->occupancies = [ $occupancy ];
$filter = new Filter();
$filter->zone = 64 ;
$rqData->filter = [ $filter ];
$availRS = $apiClient->availability($rqData);
if ($availRS->isEmpty()) {
echo "There are no results!";
}
$allResponse = $availRS->hotels->toArray();
As you can see I set the filter to zone 64 which gives me the following error:
Fatal error: Uncaught exception 'Exception' with message 'Type error: Field filter needs hotelbeds\hotel_api_sdk\model\Filter type!' in C:\xampp2\htdocs\hotelbeds\src\generic\DataContainer.php:58 Stack trace: #0 C:\xampp2\htdocs\hotelbeds\test.php(110): hotelbeds\hotel_api_sdk\generic\DataContainer->__set('filter', Array) #1 {main} thrown in C:\xampp2\htdocs\hotelbeds\src\generic\DataContainer.php on line 58
I did add the zone to the filterclass as an integer.
I got this filter from the testfunction http://testapi.hotelbeds.com/search -> request
{
"stay": {
"checkIn": "2017-05-08",
"checkOut": "2017-05-12",
"shiftDays": 2
},
"occupancies": [
{
"rooms": 1,
"adults": "2",
"children": "0",
"paxes": [
{
"type": "AD",
"age": "30"
},
{
"type": "AD",
"age": "30"
}
]
}
],
"filter": {
"maxHotels": 20,
"maxRooms": 4,
"maxRatesPerRoom": 3,
"minCategory": 1,
"maxCategory": 5,
"paymentType": "BOTH",
"maxRate": "3000"
},
"destination": {
"code": "PAR",
"zone": "64"
}
}
Would be great if anybody could tell me what I'm doing wrong.
Thanks in advance!