| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <?php
- namespace AppBundle\Entity\Booking;
- use AppBundle\Annotation\DefaultField;
- use AppBundle\Entity\Traits\ActivityYearTrait;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- /**
- * Représente une période d'absence pour un Access dans une Organization
- */
- #[ORM\Entity]
- class Attendance implements IAttendance
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- use ActivityYearTrait;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['attendance', 'attendance_list'])]
- private $id;
- /**
- * @var Organization
- *
- * @DefaultField
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'attendances')]
- #[Groups(['attendance'])]
- private $organization;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'attendances')]
- #[Groups(['attendance', 'attendance_list'])]
- private $access;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'attendanceReplacements')]
- #[Groups(['attendance', 'attendance_list', 'planning_detail_attendancebooking'])]
- private $replacement;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime', nullable: true)]
- #[Assert\DateTime]
- #[Groups(['attendance', 'attendance_list'])]
- private $datetimeStart;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime', nullable: true)]
- #[Assert\DateTime]
- #[Groups(['attendance', 'attendance_list'])]
- private $datetimeEnd;
- /**
- * var ArrayCollection<AttendanceBooking>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\AttendanceBooking', cascade: ['persist'], mappedBy: 'attendance', orphanRemoval: true)]
- #[ORM\JoinColumn(nullable: false)]
- #[Groups(['attendance_attendancebooking'])]
- private $attendanceBooking;
- public function __construct()
- {
- $this->attendanceBooking = new ArrayCollection();
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set datetimeStart
- *
- * @param \DateTime $datetimeStart
- *
- * @return Attendance
- */
- public function setDatetimeStart(\DateTime $datetimeStart = null)
- {
- $this->datetimeStart = $datetimeStart;
- return $this;
- }
- /**
- * Get datetimeStart
- *
- * @return \DateTime
- */
- public function getDatetimeStart()
- {
- return $this->datetimeStart;
- }
- /**
- * Set datetimeEnd
- *
- * @param \DateTime $datetimeEnd
- *
- * @return Attendance
- */
- public function setDatetimeEnd(\DateTime $datetimeEnd = null)
- {
- $this->datetimeEnd = $datetimeEnd;
- return $this;
- }
- /**
- * Get datetimeEnd
- *
- * @return \DateTime
- */
- public function getDatetimeEnd()
- {
- return $this->datetimeEnd;
- }
- /**
- * Set organization
- *
- * @param \AppBundle\Entity\Organization\Organization $organization
- *
- * @return Attendance
- */
- public function setOrganization(\AppBundle\Entity\Organization\Organization $organization = null)
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * Get organization
- *
- * @return \AppBundle\Entity\Organization\Organization
- */
- public function getOrganization()
- {
- return $this->organization;
- }
- /**
- * Set access
- *
- * @param \AppBundle\Entity\AccessAndFunction\Access $access
- *
- * @return Attendance
- */
- public function setAccess(\AppBundle\Entity\AccessAndFunction\Access $access = null)
- {
- $this->access = $access;
- return $this;
- }
- /**
- * Get access
- *
- * @return \AppBundle\Entity\AccessAndFunction\Access
- */
- public function getAccess()
- {
- return $this->access;
- }
- /**
- * Set replacement
- *
- * @param \AppBundle\Entity\AccessAndFunction\Access $replacement
- *
- * @return Attendance
- */
- public function setReplacement(\AppBundle\Entity\AccessAndFunction\Access $replacement = null)
- {
- $this->replacement = $replacement;
- return $this;
- }
- /**
- * Get replacement
- *
- * @return \AppBundle\Entity\AccessAndFunction\Access
- */
- public function getReplacement()
- {
- return $this->replacement;
- }
- /**
- * Add attendanceBooking
- *
- * @param \AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking
- *
- * @return Attendance
- */
- public function addAttendanceBooking(\AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking)
- {
- $attendanceBooking->setAttendance($this);
- $attendanceBooking->setAccess($this->getAccess());
- $this->attendanceBooking[] = $attendanceBooking;
- return $this;
- }
- /**
- * Remove attendanceBooking
- *
- * @param \AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking
- */
- public function removeAttendanceBooking(\AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking)
- {
- $this->attendanceBooking->removeElement($attendanceBooking);
- }
- /**
- * Get attendanceBooking
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getAttendanceBooking()
- {
- return $this->attendanceBooking;
- }
- }
|