Closed danplaton closed 3 years ago
Hi @danplaton !
You need to call parent constructor in Book
entity, because that is where translation collection is initialised.
And something not related to this issue I noticed: there is no need to map title and description in Book
to the database. Those fields will be saved in BookTranslation
entity with locale it belongs to. Book
only has this two fields to show them translated in response.
I hope this helps. Good luck!
hello. I have a fresh installation of the api platform with locastic translation bundle. After setting up the Entity and Translation entity when I do a POST request to create a new book I get this error:
Uncaught Error: Return value of Locastic\ApiPlatformTranslationBundle\Model\AbstractTranslatable::getTranslations() must implement interface Doctrine\Common\Collections\Collection, null returned
My Book.php
My BookTranslation.php
PHP version:
PHP 7.4.9 (cli) (built: Aug 4 2020 11:52:41) ( ZTS Visual C++ 2017 x64 )
MySQL version:MySQL 8.0.21
Why does this is caused?