TypeOfPractice.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace AppBundle\Entity\Organization;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Dunglas\ApiBundle\Annotation\Iri;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use AppBundle\Entity\Traits\TimestampableEntity;
  9. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  10. /**
  11. * Types d'activités proposées par une structure
  12. *
  13. * @Iri("http://schema.org/Activity")
  14. */
  15. #[ORM\Entity]
  16. class TypeOfPractice
  17. {
  18. use TimestampableEntity;
  19. use CreatorUpdaterEntity;
  20. /**
  21. * @var int
  22. */
  23. #[ORM\Column(type: 'integer')]
  24. #[ORM\Id]
  25. #[ORM\GeneratedValue(strategy: 'AUTO')]
  26. #[Groups(['typeofpractice', 'network_list', 'typeofpractice_reference'])]
  27. private $id;
  28. /**
  29. * @var string The name of the item.
  30. */
  31. #[ORM\Column(type: 'string', nullable: false)]
  32. #[Assert\Type(type: 'string')]
  33. #[Assert\NotNull]
  34. #[Assert\Choice(callback: ['\AppBundle\Enum\Cotisation\TypeOfPracticeEnum', 'toArray'])]
  35. #[Groups(['typeofpractice', 'network_list_typeofpractices', 'typeofpractice_reference'])]
  36. private $name;
  37. /**
  38. * @var string The name of the item.
  39. */
  40. #[ORM\Column(type: 'string', nullable: false)]
  41. #[Assert\Type(type: 'string')]
  42. #[Assert\NotNull]
  43. #[Assert\Choice(callback: ['\AppBundle\Enum\Cotisation\CategoryTypeOfPracticeEnum', 'toArray'])]
  44. #[Groups(['typeofpractice', 'typeofpractice_reference'])]
  45. private $category;
  46. /**
  47. * @var ArrayCollection<Organization>
  48. */
  49. #[Assert\Valid]
  50. #[ORM\ManyToMany(targetEntity: 'Organization', mappedBy: 'typeOfPractices')]
  51. #[Groups(['typeofpractice'])]
  52. private $organization;
  53. public function __construct() {
  54. $this->organization = new ArrayCollection();
  55. }
  56. /**
  57. * Gets id.
  58. *
  59. * @return int
  60. */
  61. public function getId()
  62. {
  63. return $this->id;
  64. }
  65. /**
  66. * Gets name.
  67. *
  68. * @return string
  69. */
  70. public function getName()
  71. {
  72. return $this->name;
  73. }
  74. /**
  75. * Gets category.
  76. *
  77. * @return string
  78. */
  79. public function getCategory()
  80. {
  81. return $this->category;
  82. }
  83. }