Reputation: 1915
I want to add a custom hydrator in my Symfony 2.8 project. The official Doctrine documentation says to add the following code into ORM configuration file.
<?php
$em->getConfiguration()->addCustomHydrationMode('CustomHydrator', 'MyProject\Hydrators\CustomHydrator');
I have no such file in my project yet, where I should create it and how to include it into my Symfony app?
Upvotes: 0
Views: 310
Reputation: 41
You can put your Hydrator file in your Bundle, exemple of path:
\Your\Bundle\Hydrators\ListHydrator
More information: https://techpunch.co.uk/development/create-custom-doctrine2-hydrator-symfony2
Upvotes: 1
Reputation: 603
You should find everything you need in the official documentation of Symfony.
http://symfony.com/doc/current/reference/configuration/doctrine.html
Symfony is using YAML or XML configuration files for the most bundles. In your case you just need to add the hydrators in doctrine.orm.entity_managers.YOUR_EM.hydrators
.
Upvotes: 1