symfony - Doctrine 2: Not all entities get persisted, why? -


i'm trying persist feedback entities in loop. problem is, 1 entity doesn't persisted (no matter how many entities want persist @ all; it's n-1 instead of n).

to understand following code snippet have know survey entity can contain several feedback entities (1..n relation).

let's if $feedbackcount = 10 9 feedback entities persisted database. @ end of post can see according doctrine unit of work. shows 10 feedback entities added to survey (so loop working right) 9 feedback entities listet @ end.

any ideas guys?

here's code:

for ($count = 0; $count < $feedbackcount; $count++) {              $feedback = new feedback();             $feedback->setfeedback("no feedback yet");             $feedback->setsurvey($survey);             // add feedback survey             $survey->addfeedback($feedback);             // persist feedback             $entitymanager->persist($survey); // persist($feedback) has same effect         } // end      $uof = $entitymanager->getunitofwork();     dump($uof); 

here's unit of work of dump statement: enter image description here

here yaml entity configs of...

feedback:

manytoone:     survey:         targetentity: app\apibundle\entity\survey         inversedby: feedbacks         cascade: ["persist"]         joincolumn:             name: surveyid             referencedcolumnname: id 

survey:

onetomany:     feedbacks:         targetentity: app\apibundle\entity\feedback         cascade: ["persist", "merge"]          mappedby: survey 

update:

as asked malcom, following screenshot shows within arraycolletion feedback entity(0) has same properties feedback entity(1). there no difference. (irrelevant properties blurred) enter image description here

solution:

see last comment.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -