*/ #[Assert\Valid] #[ORM\OneToMany(targetEntity: 'WorkByUser', mappedBy: 'work', cascade: ['persist'], orphanRemoval: true)] #[Groups(['work'])] private $workByUsers; /** * @var ArrayCollection. */ #[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; } }