Managing the model the modern way
As we saw in previous chapters, the model interactions in the legacy controllers were handled by the ObjectModel
child classes. In versions of PrestaShop above v1.7.6, modules can use the Doctrine ORM linked to Symfony. In the Doctrine language, we designate the model object as an entity.
Creating the callback request entity
To sum up how the Doctrine way of creating a model works, we have to follow these steps:
- Create the
src/
folder at the root of your module folder. This is the folder that will contain all the Symfony classes that we will create and use. - Create a
composer.json
file at the root of your module folder to handle autoloading classes in our module with a defined namespace following the PSR-4 standard, using thesrc/
folder as the root of our namespace. - Create a table manually via the
install()
function. We can’t use the Doctrine command-line tools to manage table creation as we are used to doing with a normal...