kontent-ai / delivery-sdk-php

Kontent.ai Delivery SDK for PHP
https://kontent.ai
MIT License
46 stars 15 forks source link

Added - Support for nested taxonomy terms (#37) #46

Closed dusekdan closed 6 years ago

dusekdan commented 6 years ago

The taxonomy models are hierarchical.

dusekdan commented 6 years ago

Well, I introduced review changes, but now some tests fail with error originating in DefaultMapper.getProperty(), because 'ELEMENTS' attribute is not present (presumably within Term class).

Stacktrace is as follows:

14) KenticoCloud\Tests\E2E\ModelBindingTest::testHomeModel
Undefined index: elements
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/DefaultMapper.php:80
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:120
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:236
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:164
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:130
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:263
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:168
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:130
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/ModelBinder.php:89
/home/travis/build/Kentico/delivery-sdk-php/src/KenticoCloud/Delivery/DeliveryClient.php:127
/home/travis/build/Kentico/delivery-sdk-php/tests/E2E/ModelBindingTest.php:94

And I just can not see the connection to my changes. For now, anyways. What am I missing?

petrsvihlik commented 6 years ago

it's because of unifying the taxonomy term classes. now you expect the /items api to return nested terms ($terms) which is not the case. please either split the classes again or make one inherit the other...

dusekdan commented 6 years ago

5th time's the charm.