Guest User

Untitled

a guest
Oct 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. class Azienda {
  2. protected $indirizzi;
  3.  
  4. //molte cose inutili
  5.  
  6. public function __construct()
  7. {
  8. $this->indirizzi = new ArrayCollection();
  9. }
  10.  
  11. //metodo incriminato
  12. public function setIndirizzi(ArrayCollection $indirizzi)
  13. {
  14. foreach ($indirizzi as $indirizzo)
  15. {
  16. if($indirizzo instanceof Indirizzo)
  17. $indirizzo->setAzienda($this);
  18. else
  19. throw new InvalidTypeException();
  20. }
  21. $this->indirizzi = $indirizzi;
  22. }
  23.  
  24. /**
  25. * Get indirizzi
  26. *
  27. * @return Doctrine\Common\Collections\Collection
  28. */
  29. public function getIndirizzi()
  30. {
  31. return $this->indirizzi;
  32. }
  33.  
  34. /**
  35. * Add indirizzi
  36. *
  37. * @param AIC\ContattiBundle\Entity\Indirizzo $indirizzi
  38. */
  39. public function addIndirizzi(\AIC\ContattiBundle\Entity\Indirizzo $indirizzi)
  40. {
  41. $this->indirizzi[] = $indirizzi;
  42. $indirizzi->setAzienda($this);
  43.  
  44. }
  45. }
Add Comment
Please, Sign In to add comment