Transformer\ListingSuitabilityCollection::transform() not instance of \Entity\ListingSuitabilityCollection
CreativeNative opened this issue · 0 comments
CreativeNative commented
I get the following Error when I try to post a ListingSuitabilityCollection
[Thu Apr 28 01:31:05.593975 2016] [:error] [pid 28824] [client 79.36.160.185:65504]
PHP Catchable fatal error: Argument 1 passed to
Traum\\Transformer\\ListingSuitabilityCollection::transform() must be an instance of
Traum\\Entity\\ListingSuitabilityCollection,
instance of Traum\\Entity\\ListingSuitability given,
called in
/var/www/ferienhaussizilien.de/trunk/vendor/league/fractal/src/Scope.php on line 338
and defined in
/var/www/ferienhaussizilien.de/trunk/vendor/aferalabs/traum/src/Transformer/ListingSuitabilityCollection.php on line 19
My code looks like following:
$suitability = [
[
Entity\ListingSuitability::SUITABILITY_ID => Enum\Suitability::NON_SMOKERS,
Entity\ListingSuitability::SUITABILITY_STATUS_ID => Enum\SuitabilityStatus::NOT_ALLOWED
],
[
Entity\ListingSuitability::SUITABILITY_ID => Enum\Suitability::FAMILIES,
Entity\ListingSuitability::SUITABILITY_STATUS_ID => Enum\SuitabilityStatus::ALLOWED
],
[
Entity\ListingSuitability::SUITABILITY_ID => Enum\Suitability::DOGS,
Entity\ListingSuitability::SUITABILITY_STATUS_ID => ($rental->getEqpets()) ?
Enum\SuitabilityStatus::ALLOWED : Enum\SuitabilityStatus::NOT_ALLOWED
],
];
$suitabilityCollection = Entity\ListingSuitabilityCollection::fromArray($suitability);
$responses['suitability'] = $client->createListingResource()->postSuitabilities(
136390,
$suitabilityCollection
);