Guest User

Untitled

a guest
Mar 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. concert_id stays empty:
  2.  
  3. $c = new \Entities\Concert();
  4.  
  5. $pic = new \Entities\Picture();
  6. $pic->url = $img_url;
  7. $pic->text = $img_name;
  8. $pic->name = "$img_name.$img_suff";
  9.  
  10. $c->pictures->add($pic);
  11. $this->em->persist($c);
  12. $this->em->flush();
  13.  
  14. However, this works:
  15.  
  16. $pic = new \Entities\Picture();
  17. $pic->concert = $c;
  18. $pic->url = $img_url;
  19. $pic->text = $img_name;
  20. $pic->name = "$img_name.$img_suff";
  21. $this->em->persist($pic);
  22. $this->em->flush();
Add Comment
Please, Sign In to add comment