| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <?php
- namespace AppBundle\Entity\Booking;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- *
- * Travail à faire pour un cours
- *
- * @Iri("http://schema.org/Work")
- */
- #[ORM\Entity]
- class Work
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['work', 'worksbyusers_db'])]
- private $id;
- /**
- * @var Course
- */
- #[ORM\ManyToOne(targetEntity: 'Course', inversedBy: 'work')]
- #[Groups(['work', 'worksbyusers_db_work'])]
- private $course;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'datetime')]
- #[Assert\DateTime]
- #[Assert\NotNull]
- #[Groups(['work', 'worksbyusers_db_work'])]
- private $datetime;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['work', 'worksbyusers_db_work'])]
- private $work;
- /**
- * @var ArrayCollection<WorkByUser>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'WorkByUser', mappedBy: 'work', cascade: ['persist'], orphanRemoval: true)]
- #[Groups(['work'])]
- private $workByUsers;
- /**
- * @var ArrayCollection<AppBundle\Entity\Core\File>.
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Core\File', mappedBy: 'work', orphanRemoval: true)]
- #[Groups(['work', 'worksbyusers_db_work'])]
- private $files;
- public function __construct()
- {
- $this->workByUsers = new ArrayCollection();
- $this->files = 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 course.
- *
- * @param Course $course
- *
- * @return $this
- */
- public function setCourse(Course $course = null)
- {
- $this->course = $course;
- return $this;
- }
- /**
- * Gets course.
- *
- * @return Course
- */
- public function getCourse()
- {
- return $this->course;
- }
- /**
- * Sets datetime.
- *
- * @param \DateTime $datetime
- *
- * @return $this
- */
- public function setDatetime(\DateTime $datetime)
- {
- $datetime->setTime($datetime->format("H"), $datetime->format("i"), 0);
- $datetime->setTimezone(new \DateTimeZone('UTC'));
- $this->datetime = $datetime;
- return $this;
- }
- /**
- * Gets datetime.
- *
- * @return \DateTime
- */
- public function getDatetime()
- {
- return $this->datetime;
- }
- /**
- * Sets works.
- *
- * @param string $work
- *
- * @return $this
- */
- public function setWork($work)
- {
- $this->work = $work;
- return $this;
- }
- /**
- * Gets work.
- *
- * @return string
- */
- public function getWork()
- {
- return $this->work;
- }
- /**
- * Add work By User
- *
- * @param WorkByUser $workByUSer
- *
- * @return Work
- */
- public function addWorkByUser(WorkByUser $workByUSer)
- {
- $workByUSer->setWork($this);
- $this->workByUsers[] = $workByUSer;
- return $this;
- }
- /**
- * Remove work By User
- *
- * @param WorkByUser $workByUSer
- */
- public function removeWorkByUser(WorkByUser $workByUSer)
- {
- $this->workByUsers->removeElement($workByUSer);
- }
- /**
- * Get work By User
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getWorkByUsers()
- {
- return $this->workByUsers;
- }
- /**
- * Add file
- *
- * @param \AppBundle\Entity\Core\File $file
- *
- * @return Work
- */
- public function addFile(\AppBundle\Entity\Core\File $file)
- {
- $file->setWork($this);
- $this->files[] = $file;
- return $this;
- }
- /**
- * Remove file
- *
- * @param \AppBundle\Entity\Core\File $file
- */
- public function removeFile(\AppBundle\Entity\Core\File $file)
- {
- $this->files->removeElement($file);
- }
- /**
- * Get files
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getFiles()
- {
- return $this->files;
- }
- }
|