i've try to hydrate an nested array to entities.
The array looks something like this
<?php
$arrData = array(
'username' => 'test',
'email' => 'test@test.at',
'images' => array(
array(
'name' => 'test',
'url' => 'http://url1.test'
),
array(
'name' => 'test',
'url' => 'http://url1.test'
)
)
);
?>
So how you can see, there is an one to many relation between user and images. So if what i want to do, is i want do hydrate them into an User entity something like this:
<?php
$hydrator = new \DoctrineModule\Stdlib\Hydrator\DoctrineObject($objectManager);
$user = $hydrator->hydrate($arrData, new \Application\Entity\User());
?>
So if i try this, i get an exception with
Doctrine\ORM\ORMException
The identifier id is missing for a query of Application\Entity\Image
What ive seen is, doctrine try to find some entry at the database, but i need to create a new entry.
The thing is, i want to hydrate REST data, so i dont define any form or fieldsets.
Does anyone have an idea?
regards