JonnyD / AirbnbSDK

A PHP wrapper for Airbnb API
47 stars 15 forks source link

Doctrine\Common\Annotations\AnnotationException #2

Open dave7280 opened 7 years ago

dave7280 commented 7 years ago

Doctrine\Common\Annotations\AnnotationException Semantical Error The annotation "@JMS\Serializer\Annotation\Type" in property AirbnbSDK\Response\Listing\ListingResponse::$listing does not exist, or could not be auto-loaded.

mtownsend5512 commented 7 years ago

I'm having the same issue.

dimitrisGiannakakis commented 6 years ago

Hello i am having the same issue...

Please provide a solution

dave7280 commented 6 years ago

Try to download library then modify source code by removing annotation that it complain about:

@JMS\Type("AirbnbSDK\Response\Listing\Listing\Listing")

from

https://github.com/JonnyD/AirbnbSDK/blob/650f7568c46549a378aa14d6d0e1b06eb77d583d/src/AirbnbSDK/Response/Listing/ListingResponse.php

I didn't test, but maybe it's gonna work. I remember that i somehow solved it by modifying source.

piep14 commented 5 years ago

Dont work for me. Who have a solution ? Thank you

dearsina commented 5 years ago

This is a bit of a brutal hack, but it seems to have worked for me:

Find the following file:

https://github.com/JonnyD/AirbnbSDK/blob/master/src/AirbnbSDK/HttpClient/HttpClient.php

Replace line 124:

$response = $serializer->deserialize($contents, $deserializeTo, 'json');

with:

$response = json_decode($contents);

The issue seems to be with the framework that is parsing the otherwise healthy result that is coming back from AirBnB. The hack circumvents the whole framework and just does a simple translate from JSON to a PHP Object.

I'm not sure what wider implications this has, or whether I'll need to hack some other parts also to make everything work, but for now, the listings search works, and that was my primary objective. Happy coding!