| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733 |
- <?php
- namespace AppBundle\Entity\Place;
- use AppBundle\Annotation\ExportSplitFields;
- use AppBundle\Entity\Booking\Course;
- use AppBundle\Entity\Booking\EducationalProject;
- use AppBundle\Entity\Booking\Event;
- use AppBundle\Entity\Booking\Examen;
- use AppBundle\Entity\Core\File;
- use AppBundle\Entity\Core\ContactPoint;
- use AppBundle\Entity\Product\Equipment;
- use AppBundle\Entity\Traits\ContactPointType;
- 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;
- use AppBundle\Entity\Core\ContactInterface;
- /**
- * Salle d'une Place
- */
- #[ORM\Entity]
- class Room implements ContactInterface
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- use ContactPointType;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['room', 'equipment_list', 'equipmentrepair_list_equipment', 'equipmentaccounting_list', 'equipmentmediatheque_list', 'equipmentcostume_list', 'place_list', 'examenconvocation_list_examen', 'planning_list', 'examen_details', 'course_details', 'educationalproject_details', 'planning_detail', 'event_details'])]
- private $id;
- /**
- * @var Place
- */
- #[Assert\NotNull]
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Place\Place', inversedBy: 'rooms')]
- private $place;
- /**
- * @var string
- */
- #[Assert\Type(type: 'string')]
- #[ORM\Column(type: 'string', nullable: true)]
- #[Groups(['room', 'room_reference', 'equipment_list_roomstorage', 'equipment_list_roomwhereisused', 'equipmentrent_list_equipment', 'equipmentloan_list_equipment', 'equipmentcontrol_list_equipment', 'equipmentrepair_list_equipment', 'equipmentaccounting_list_roomwhereisused', 'equipmentmediatheque_list_roomwhereisused', 'equipmentcostume_list_roomwhereisused', 'equipmentaccounting_list_roomstorage', 'equipmentmediatheque_list_roomstorage', 'equipmentcostume_list_roomstorage', 'place_list_rooms', 'examenconvocation_list_examen', 'planning_list', 'examen_details_room', 'course_details_room', 'educationalproject_details_room', 'reportmessage', 'planning_detail_room', 'student_list_courses', 'event_details_room'])]
- private $name;
- /**
- * @var string A short description of the item.
- */
- #[Assert\Type(type: 'string')]
- #[ORM\Column(type: 'text', nullable: true)]
- #[Groups(['room', 'place_list_rooms'])]
- private $description;
- /**
- * @var string
- */
- #[Assert\Type(type: 'string')]
- #[ORM\Column(type: 'string', nullable: true)]
- #[Groups(['room', 'place_list_rooms'])]
- private $localisation;
- /**
- * @var int
- */
- #[Assert\Type(type: 'integer', message: 'invalid-integer')]
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Groups(['room', 'place_list_rooms', 'room_reference'])]
- private $capacity;
- /**
- * @var int
- */
- #[Assert\Type(type: 'integer', message: 'invalid-integer')]
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Groups(['room', 'place_list_rooms', 'room_reference'])]
- private $floorSize;
- /**
- * @var ArrayCollection<OpeningHoursSpecification>
- */
- #[Assert\Valid]
- #[ORM\ManyToMany(targetEntity: 'OpeningHoursSpecification', cascade: ['persist'], orphanRemoval: true)]
- #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'room_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'openinghoursspecification_id', referencedColumnName: 'id', unique: true)]
- #[Groups(['room_openinghoursspecification'])]
- private $openingHoursSpecification;
- // /**
- // * @var ArrayCollection<ContactPoint>
- // */
- // #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\ContactPoint')]
- // #[Groups(['room_contactpoint'])]
- // // private $contactpoint;
- // /**
- // * @var ArrayCollection<Equipment>
- // */
- // #[Assert\Valid]
- // #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Product\Equipment', cascade: ['persist'])]
- // #[ORM\JoinTable(joinColumns: [], inverseJoinColumns: [])]
- // #[ORM\JoinColumn(name: 'room_id', referencedColumnName: 'id')]
- // #[ORM\JoinColumn(name: 'equipment_id', referencedColumnName: 'id', unique: true)]
- // #[Groups(['room_equipment'])]
- // private $equipments;
- /**
- * @var ArrayCollection<RoomControl>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'RoomControl', mappedBy: 'room', cascade: ['persist'], orphanRemoval: true)]
- #[ORM\JoinColumn(nullable: false)]
- #[Groups(['room_control'])]
- private $controls;
- /**
- * @var ArrayCollection<AppBundle\Entity\Place\RoomRepair>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Place\RoomRepair', mappedBy: 'room', cascade: ['persist'], orphanRemoval: true)]
- #[ORM\JoinColumn(nullable: false)]
- #[Groups(['room_repair'])]
- private $repairs;
- /**
- * @var ArrayCollection<Course>
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Course', mappedBy: 'room')]
- #[Groups(['room_booking'])]
- private $courses;
- /**
- * @var ArrayCollection<EducationalProject>
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\EducationalProject', mappedBy: 'room')]
- #[Groups(['room_booking'])]
- private $educationalProjects;
- /**
- * @var ArrayCollection<Event>
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Event', mappedBy: 'room')]
- #[Groups(['room_booking'])]
- private $events;
- /**
- * @var ArrayCollection<Examen>
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Examen', mappedBy: 'room')]
- #[Groups(['room_booking'])]
- private $examens;
- /**
- * @var ArrayCollection<Equipment>
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Product\Equipment', mappedBy: 'roomStorage')]
- #[Groups(['room_equipment'])]
- private $equipmentStorages;
- /**
- * @var ArrayCollection<Equipment>
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Product\Equipment', mappedBy: 'roomWhereIsUsed')]
- #[Groups(['room_equipment'])]
- private $equipmentUseds;
- /**
- * @var array
- * @ExportSplitFields({"name","description","localisation","floorSize","capacity"})
- *
- */
- #[Groups(['template'])]
- private $fullLabelTemplate;
- public function __construct()
- {
- $this->openingHoursSpecification = new ArrayCollection();
- // $this->contactpoint = new ArrayCollection();
- // $this->equipments = new ArrayCollection();
- $this->repairs = new ArrayCollection();
- $this->controls = new ArrayCollection();
- $this->courses = new ArrayCollection();
- $this->educationalProjects = new ArrayCollection();
- $this->events = new ArrayCollection();
- $this->examens = new ArrayCollection();
- $this->equipmentStorages = new ArrayCollection();
- $this->equipmentUseds = 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 place.
- *
- * @param Place $place
- *
- * @return $this
- */
- public function setPlace(Place $place)
- {
- $this->place = $place;
- return $this;
- }
- /**
- * Gets place.
- *
- * @return Place
- */
- public function getPlace()
- {
- return $this->place;
- }
- /**
- * 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 floorSize.
- *
- * @param int $floorSize
- *
- * @return $this
- */
- public function setFloorSize($floorSize)
- {
- $this->floorSize = $floorSize;
- return $this;
- }
- /**
- * Gets floorSize.
- *
- * @return int
- */
- public function getFloorSize()
- {
- return $this->floorSize;
- }
- /**
- * 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;
- }
- /**
- * Sets localisation.
- *
- * @param string $localisation
- *
- * @return $this
- */
- public function setLocalisation($localisation)
- {
- $this->localisation = $localisation;
- return $this;
- }
- /**
- * Gets localisation.
- *
- * @return string
- */
- public function getLocalisation()
- {
- return $this->localisation;
- }
- /**
- * Sets capacity.
- *
- * @param int $capacity
- *
- * @return $this
- */
- public function setCapacity($capacity)
- {
- $this->capacity = $capacity;
- return $this;
- }
- /**
- * Gets capacity.
- *
- * @return int
- */
- public function getCapacity()
- {
- return $this->capacity;
- }
- /**
- * Adds openingHoursSpecification.
- *
- * @param OpeningHoursSpecification $openingHoursSpecification
- *
- * @return $this
- */
- public function addOpeningHoursSpecification(OpeningHoursSpecification $openingHoursSpecification)
- {
- $this->openingHoursSpecification[] = $openingHoursSpecification;
- return $this;
- }
- /**
- * Removes openingHoursSpecification.
- *
- * @param OpeningHoursSpecification $openingHoursSpecification
- *
- * @return $this
- */
- public function removeOpeningHoursSpecification(OpeningHoursSpecification $openingHoursSpecification)
- {
- $this->openingHoursSpecification->removeElement($openingHoursSpecification);
- return $this;
- }
- /**
- * Gets openingHoursSpecification.
- *
- * @return ArrayCollection<OpeningHoursSpecification>
- */
- public function getOpeningHoursSpecification()
- {
- return $this->openingHoursSpecification;
- }
- // /**
- // * Adds contactpoint.
- // *
- // * @param ContactPoint $contactpoint
- // *
- // * @return $this
- // */
- // public function addContactpoint(ContactPoint $contactpoint)
- // {
- // $this->contactpoint[] = $contactpoint;
- // return $this;
- // }
- // /**
- // * Removes contactpoint.
- // *
- // * @param ContactPoint $contactpoint
- // *
- // * @return $this
- // */
- // public function removeContactpoint(ContactPoint $contactpoint)
- // {
- // $this->contactpoint->removeElement($contactpoint);
- // return $this;
- // }
- // /**
- // * Gets contactpoint.
- // *
- // * @return ArrayCollection<ContactPoint>
- // */
- // public function getContactpoint()
- // {
- // return $this->contactpoint;
- // }
- /**
- * Adds control.
- *
- * @param RoomControl $control
- *
- * @return $this
- */
- public function addControl(RoomControl $control)
- {
- $control->setRoom($this);
- $this->controls[] = $control;
- return $this;
- }
- /**
- * Removes control.
- *
- * @param RoomControl $control
- *
- * @return $this
- */
- public function removeControl(RoomControl $control)
- {
- $this->controls->removeElement($control);
- return $this;
- }
- /**
- * Gets control.
- *
- * @return ArrayCollection<RoomControl>
- */
- public function getControls()
- {
- return $this->controls;
- }
- /**
- * Adds repair.
- *
- * @param RoomRepair $repair
- *
- * @return $this
- */
- public function addRepair(RoomRepair $repair)
- {
- $repair->setRoom($this);
- $this->repairs[] = $repair;
- return $this;
- }
- /**
- * Removes repair.
- *
- * @param RoomRepair $repair
- *
- * @return $this
- */
- public function removeRepair(RoomRepair $repair)
- {
- $this->repairs->removeElement($repair);
- return $this;
- }
- /**
- * Gets repairs.
- *
- * @return ArrayCollection<RoomRepair>
- */
- public function getRepairs()
- {
- return $this->repairs;
- }
- // /**
- // * Add equipment
- // *
- // * @param \AppBundle\Entity\Product\Equipment $equipment
- // *
- // * @return Room
- // */
- // public function addEquipment(\AppBundle\Entity\Product\Equipment $equipment)
- // {
- // $this->equipments[] = $equipment;
- // return $this;
- // }
- // /**
- // * Remove equipment
- // *
- // * @param \AppBundle\Entity\Product\Equipment $equipment
- // */
- // public function removeEquipment(\AppBundle\Entity\Product\Equipment $equipment)
- // {
- // $this->equipments->removeElement($equipment);
- // }
- // /**
- // * Get equipments
- // *
- // * @return \Doctrine\Common\Collections\Collection
- // */
- // public function getEquipments()
- // {
- // return $this->equipments;
- // }
- /**
- * Add course
- *
- * @param \AppBundle\Entity\Booking\Course $course
- *
- * @return Room
- */
- public function addCourse(\AppBundle\Entity\Booking\Course $course)
- {
- $this->courses[] = $course;
- return $this;
- }
- /**
- * Remove course
- *
- * @param \AppBundle\Entity\Booking\Course $course
- */
- public function removeCourse(\AppBundle\Entity\Booking\Course $course)
- {
- $this->courses->removeElement($course);
- }
- /**
- * Get courses
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getCourses()
- {
- return $this->courses;
- }
- /**
- * Add educationalProject
- *
- * @param \AppBundle\Entity\Booking\EducationalProject $educationalProject
- *
- * @return Room
- */
- public function addEducationalProject(\AppBundle\Entity\Booking\EducationalProject $educationalProject)
- {
- $this->educationalProjects[] = $educationalProject;
- return $this;
- }
- /**
- * Remove educationalProject
- *
- * @param \AppBundle\Entity\Booking\EducationalProject $educationalProject
- */
- public function removeEducationalProject(\AppBundle\Entity\Booking\EducationalProject $educationalProject)
- {
- $this->educationalProjects->removeElement($educationalProject);
- }
- /**
- * Get educationalProjects
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getEducationalProjects()
- {
- return $this->educationalProjects;
- }
- /**
- * Add event
- *
- * @param \AppBundle\Entity\Booking\Event $event
- *
- * @return Room
- */
- public function addEvent(\AppBundle\Entity\Booking\Event $event)
- {
- $this->events[] = $event;
- return $this;
- }
- /**
- * Remove event
- *
- * @param \AppBundle\Entity\Booking\Event $event
- */
- public function removeEvent(\AppBundle\Entity\Booking\Event $event)
- {
- $this->events->removeElement($event);
- }
- /**
- * Get events
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getEvents()
- {
- return $this->events;
- }
- /**
- * Add examen
- *
- * @param \AppBundle\Entity\Booking\Examen $examen
- *
- * @return Room
- */
- public function addExamen(\AppBundle\Entity\Booking\Examen $examen)
- {
- $this->examens[] = $examen;
- return $this;
- }
- /**
- * Remove examen
- *
- * @param \AppBundle\Entity\Booking\Examen $examen
- */
- public function removeExamen(\AppBundle\Entity\Booking\Examen $examen)
- {
- $this->examens->removeElement($examen);
- }
- /**
- * Get examens
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getExamens()
- {
- return $this->examens;
- }
- /**
- * Add equipmentStorage
- *
- * @param \AppBundle\Entity\Product\Equipment $equipmentStorage
- *
- * @return Room
- */
- public function addEquipmentStorage(\AppBundle\Entity\Product\Equipment $equipmentStorage)
- {
- $this->equipmentStorages[] = $equipmentStorage;
- return $this;
- }
- /**
- * Remove equipmentStorage
- *
- * @param \AppBundle\Entity\Product\Equipment $equipmentStorage
- */
- public function removeEquipmentStorage(\AppBundle\Entity\Product\Equipment $equipmentStorage)
- {
- $this->equipmentStorages->removeElement($equipmentStorage);
- }
- /**
- * Get equipmentStorages
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getEquipmentStorages()
- {
- return $this->equipmentStorages;
- }
- /**
- * Add equipmentUsed
- *
- * @param \AppBundle\Entity\Product\Equipment $equipmentUsed
- *
- * @return Room
- */
- public function addEquipmentUsed(\AppBundle\Entity\Product\Equipment $equipmentUsed)
- {
- $equipmentUsed->setRoomWhereIsUsed($this);
- $this->equipmentUseds[] = $equipmentUsed;
- return $this;
- }
- /**
- * Remove equipmentUsed
- *
- * @param \AppBundle\Entity\Product\Equipment $equipmentUsed
- */
- public function removeEquipmentUsed(\AppBundle\Entity\Product\Equipment $equipmentUsed)
- {
- $equipmentUsed->setRoomWhereIsUsed(null);
- $this->equipmentUseds->removeElement($equipmentUsed);
- }
- /**
- * Get equipmentUseds
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getEquipmentUseds()
- {
- return $this->equipmentUseds;
- }
- /**
- *
- * {@inheritdoc}
- */
- public function getContact() {
- return $this;
- }
- /**
- *
- * {@inheritdoc}
- */
- public function getContactAddress() {
- return $this->getPlace()->getContactAddress();
- }
- /**
- *
- * {@inheritdoc}
- */
- public function getContactName() {
- return $this->getName();
- }
- /**
- *
- * {@inheritdoc}
- */
- public function getContactContactPoint() {
- return $this->getContactPointPrincipal();
- }
- /**
- * Gets full label.
- *
- * @return array
- */
- public function getFullLabelTemplate()
- {
- return [
- $this->getName(),
- $this->getDescription(),
- $this->getLocalisation(),
- $this->getFloorSize(),
- $this->getCapacity()
- ];
- }
- }
|