| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- <?php
- namespace AppBundle\Entity\Person;
- use AppBundle\Entity\Core\Tagg;
- use AppBundle\Entity\Organization\Organization;
- use AppBundle\Entity\Traits\ActivityPeriodTrait;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- use AppBundle\Validator\Constraints\Delete as OpentalentDelete;
- use AppBundle\Annotation\DefaultField;
- /**
- * Commission à l'intérieur d'une Organization
- *
- * @Iri("http://schema.org/Commission")
- * @OpentalentDelete\EntityDelete()
- */
- #[ORM\Entity]
- class Commission
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- use ActivityPeriodTrait;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['commission', 'commission_list'])]
- private $id;
- /**
- * @var Organization
- *
- * @DefaultField
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'commissions')]
- #[ORM\JoinColumn(nullable: false)]
- #[Assert\NotNull]
- #[Groups(['commission'])]
- private $organization;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 60)]
- #[Assert\Type(type: 'string')]
- #[Assert\NotNull]
- #[Groups(['commission', 'commission_list'])]
- private $name;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 50, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['commission', 'commission_list'])]
- private $type;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 127, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['commission', 'commission_list'])]
- private $description;
- /**
- * @var ArrayCollection<CommissionMember>
- */
- #[Groups(['commission_commissionmember', 'commission_list'])]
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\CommissionMember', cascade: ['persist'], mappedBy: 'commission', orphanRemoval: true)]
- private $commissionMembers;
- /**
- * @var ArrayCollection<Tagg>
- */
- #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'commissions')]
- #[Assert\Valid]
- #[ORM\JoinTable(name: 'tag_commission', joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'commission_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- #[Groups(['commission_tags', 'manage_tags', 'commission_list'])]
- private $tags;
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->commissionMembers = new ArrayCollection();
- $this->tags = new ArrayCollection();
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Sets name.
- *
- * @param string $name
- *
- * @return $this
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * Gets name.
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Sets type.
- *
- * @param string $type
- *
- * @return $this
- */
- public function setType($type)
- {
- $this->type = $type;
- return $this;
- }
- /**
- * Gets type.
- *
- * @return string
- */
- public function getType()
- {
- return $this->type;
- }
- /**
- * Sets description.
- *
- * @param string $description
- *
- * @return $this
- */
- public function setDescription($description)
- {
- $this->description = $description;
- return $this;
- }
- /**
- * Gets description.
- *
- * @return string
- */
- public function getDescription()
- {
- return $this->description;
- }
- /**
- * Add commissionMember
- *
- * @param \AppBundle\Entity\Person\CommissionMember $commissionMember
- *
- * @return Commission
- */
- public function addCommissionMember(\AppBundle\Entity\Person\CommissionMember $commissionMember)
- {
- $this->commissionMembers[] = $commissionMember;
- $commissionMember->setCommission($this);
-
- return $this;
- }
- /**
- * Remove commissionMember
- *
- * @param \AppBundle\Entity\Person\CommissionMember $commissionMember
- */
- public function removeCommissionMember(\AppBundle\Entity\Person\CommissionMember $commissionMember)
- {
- $this->commissionMembers->removeElement($commissionMember);
- }
- /**
- * Get commissionMembers
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getCommissionMembers()
- {
- return $this->commissionMembers;
- }
- /**
- * Set organization
- *
- * @param \AppBundle\Entity\Organization\Organization $organization
- *
- * @return Commission
- */
- public function setOrganization(\AppBundle\Entity\Organization\Organization $organization)
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * Get organization
- *
- * @return \AppBundle\Entity\Organization\Organization
- */
- public function getOrganization()
- {
- return $this->organization;
- }
- /**
- * Add tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- *
- * @return Commission
- */
- public function addTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags[] = $tag;
- return $this;
- }
- /**
- * Remove tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- */
- public function removeTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags->removeElement($tag);
- }
- /**
- * Get tags
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getTags()
- {
- return $this->tags;
- }
- }
|