Paper.php 899 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Sortable\Fixture;
  3. use Gedmo\Mapping\Annotation as Gedmo;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. /**
  7. * @ORM\Entity
  8. */
  9. class Paper
  10. {
  11. /**
  12. * @ORM\Id
  13. * @ORM\GeneratedValue
  14. * @ORM\Column(type="integer")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(name="name", type="string")
  19. */
  20. private $name;
  21. /**
  22. * @ORM\OneToMany(targetEntity="Author", mappedBy="paper", cascade={"persist", "remove"})
  23. */
  24. private $authors;
  25. public function __construct() { $this->authors = new ArrayCollection(); }
  26. public function getId() { return $this->id; }
  27. public function getName() { return $this->name; }
  28. public function setName($name) { $this->name = $name; }
  29. public function getAuthors() { return $this->authors; }
  30. public function addAuthor($author) { $this->authors->add($author); }
  31. }