| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <?php
- namespace AppBundle\Entity\Person;
- use AppBundle\Annotation\ExportSplitFields;
- use AppBundle\Entity\AccessAndFunction\Access;
- 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;
- //TODO: fichier à déplacer
- /**
- * Médaille attribuée à un Access
- *
- * @Iri("http://schema.org/Medal")
- */
- #[ORM\Entity]
- class Medal
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['medal', 'medal_list', 'access_details', 'accesses_list', 'student_list', 'guardians_list', 'teachers_list', 'adherent_list', 'personnels_list', 'ca_list', 'othercontact_list', 'board_list'])]
- private $id;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'medals')]
- #[ORM\JoinColumn(nullable: false)]
- #[Assert\NotNull]
- #[Groups(['medal', 'medal_list'])]
- private $access;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['medal', 'medal_list', 'access_details_medalsfiltered', 'accesses_list_medals', 'student_list_medals', 'guardians_list_medals', 'teachers_list_medals', 'adherent_list_medals', 'personnels_list_medals', 'ca_list_medals', 'othercontact_list_medals', 'board_list_medals'])]
- private $medalDate;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string')]
- #[Assert\Type(type: 'string')]
- #[Assert\NotNull]
- #[Assert\Choice(callback: ['\AppBundle\Enum\Person\MedalTypeEnum', 'toArray'])]
- #[Groups(['medal', 'medal_list', 'access_details_medalsfiltered', 'accesses_list_medals', 'student_list_medals', 'guardians_list_medals', 'teachers_list_medals', 'adherent_list_medals', 'personnels_list_medals', 'ca_list_medals', 'othercontact_list_medals', 'board_list_medals'])]
- private $medalType;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', length: 200, nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['medal', 'medal_list', 'access_details_medalsfiltered', 'accesses_list_medals', 'student_list_medals', 'guardians_list_medals', 'teachers_list_medals', 'adherent_list_medals', 'personnels_list_medals', 'ca_list_medals', 'othercontact_list_medals', 'board_list_medals'])]
- private $otherMedalType;
- /**
- * @var string
- * @ExportSplitFields({"medalDate","medalType","otherMedalType"})
- */
- #[Groups(['template', 'student_list_medals', 'guardians_list_medals', 'personnels_list_medals', 'othercontact_list_medals', 'ca_list_medals', 'adherent_list_medals', 'accesses_list_medals', 'teachers_list_medals', 'board_list_medals'])]
- private $fullLabelTemplate;
- /**
- * 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 access.
- *
- * @param Access $access
- *
- * @return $this
- */
- public function setAccess(Access $access)
- {
- $this->access = $access;
- return $this;
- }
- /**
- * Gets access.
- *
- * @return Access
- */
- public function getAccess()
- {
- return $this->access;
- }
- /**
- * Sets medalDate.
- *
- * @param \DateTime $medalDate
- *
- * @return $this
- */
- public function setMedalDate(\DateTime $medalDate = null)
- {
- $this->medalDate = $medalDate;
- return $this;
- }
- /**
- * Gets medalDate.
- *
- * @return \DateTime
- */
- public function getMedalDate()
- {
- return $this->medalDate ? $this->medalDate->format('Y-m-d') : $this->medalDate;
- }
- /**
- * Sets medalType.
- *
- * @param string $medalType
- *
- * @return $this
- */
- public function setMedalType($medalType)
- {
- $this->medalType = $medalType;
- return $this;
- }
- /**
- * Gets medalType.
- *
- * @return string
- */
- public function getMedalType()
- {
- return $this->medalType;
- }
- /**
- * Sets otherMedalType.
- *
- * @param string $otherMedalType
- *
- * @return $this
- */
- public function setOtherMedalType($otherMedalType)
- {
- $this->otherMedalType = $otherMedalType;
- return $this;
- }
- /**
- * Gets otherMedalType.
- *
- * @return string
- */
- public function getOtherMedalType()
- {
- return $this->otherMedalType;
- }
- /**
- * Gets full label.
- *
- * @return array
- */
- public function getFullLabelTemplate()
- {
- return [
- $this->getMedalDate(),
- ['value' => $this->getMedalType(), 'translate' => true],
- $this->getOtherMedalType()
- ];
- }
- }
|