0

I have an object "Survey" link to some "Questions" entities (One To Many association). In my controller, I can add some Questions to this Survey. At the end, I would like to do some stuff before any flush.

For example, first I have : Survey1 with QuestionA and QuestionB (through $Survey->getQuestions() )

At the end : Survey1 with QuestionA QuestionB and QuestionC

Problem is :

$Survey->getQuestions()

only gave me QuestionA and QuestionB before I flush. How is it possible for me to get all objects before a flush ? It is very important for me to not flush because I make a lot of tests and I don't want to commit my changes if I am not sure that everything is ok.

eluus
  • 213
  • 1
  • 13
  • ¿Could post your code for adding new questions to the survey and the definitions of the entities? – Edu Jul 12 '16 at 10:45

1 Answers1

0

I think you have to use foreach loop to get all the questions:
foreach($Survey->getQuestions() as question){ //1st iteration you'll have QuestionA... //2nd QuestionB... }