mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 22:51:04 +01:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
f5e352bd0b
4
.gitignore
vendored
4
.gitignore
vendored
@ -17,3 +17,7 @@
|
|||||||
# Secret keys
|
# Secret keys
|
||||||
config/secrets/prod/prod.decrypt.private.php
|
config/secrets/prod/prod.decrypt.private.php
|
||||||
config/secrets/dev/
|
config/secrets/dev/
|
||||||
|
|
||||||
|
|
||||||
|
# Test
|
||||||
|
src/trash/
|
||||||
@ -10,64 +10,145 @@ use App\Repository\RoomRepository;
|
|||||||
|
|
||||||
class MapApiController extends AbstractController
|
class MapApiController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/map/api')]
|
#[Route('/map/api/test')]
|
||||||
public function test(SiteRepository $srep): JsonResponse
|
public function test(SiteRepository $rep): JsonResponse
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'message' => 'Welcome to your new controller!',
|
'message' => 'Welcome to your new controller!',
|
||||||
'path' => 'src/Controller/MapApiController.php',
|
'path' => 'src/Controller/MapApiController.php',
|
||||||
'sites' => $srep->allSites()[0]->getZeroLatitude()
|
'sites' => $rep->allSites()[0]->getZeroLatitude()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/map/api/get_floor')]
|
#[Route('/map/api/get_floor')]
|
||||||
public function get_floor(FloorRepository $srep, int $id): JsonResponse
|
public function get_floor(FloorRepository $rep, int $id, string $representation): JsonResponse
|
||||||
{
|
{
|
||||||
return $rep->get_floor(id);
|
$floor = $rep->findFloorById($id);
|
||||||
return $this->json([
|
$places = $floor->getPlace();
|
||||||
'message' => 'Welcome to your new controller!',
|
$jsonPlaces = new ArrayCollection();
|
||||||
'path' => 'src/Controller/MapApiController.php',
|
foreach ($places as $place){
|
||||||
'sites' => $srep->allSites()[0]->getZeroLatitude()
|
$jsonPlaces[] = $this->json([
|
||||||
|
'id' => $place->getId(),
|
||||||
|
'name' => $place->getName(),
|
||||||
|
'type' => $place->getType(),
|
||||||
|
'surface' => $place->getTwoDRepresentation($representation, $floor->getAltitude())
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
return $jsonPlaces;
|
||||||
|
}
|
||||||
|
|
||||||
#[Route('/map/api/find_room_by_name')]
|
#[Route('/map/api/find_place_by_name')]
|
||||||
public function find_room_by_name(RoomRepository $srep, string $name): JsonResponse
|
public function find_place_by_name(PlaceRepository $rep, string $name): JsonResponse
|
||||||
{
|
{
|
||||||
$rooms = $rep->findRoomByName($name);
|
$places = $rep->findPlaceByName($name);
|
||||||
if (sizeof($rooms)!=1) {
|
if (sizeof($places)!=1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$room = $rooms[0];
|
$place = $places[0];
|
||||||
$CP = $room->getConnectedPlaces();
|
|
||||||
if (sizeof($CP)==0) return null;
|
|
||||||
$floor = $CP[0]->getFloor();
|
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'idRoom' => $room->getId(),
|
'idRoom' => $place->getId(),
|
||||||
'idFloor' => $floor->getId()
|
'idFloor' => $place->getFloor()->getId()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[Route('/map/api/show_room_info')]
|
#[Route('/map/api/show_place_info')]
|
||||||
public function index(RoomRepository $srep, int $id): JsonResponse
|
public function index(PlaceRepository $rep, int $id): JsonResponse
|
||||||
{
|
{
|
||||||
$rooms = $rep->findRoomById($id);
|
$places = $rep->findPlaceById($id);
|
||||||
if (sizeof($rooms)!=1) {
|
if (sizeof($places)!=1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'idRoom' => $rooms[0]->getId(),
|
'idRoom' => $places[0]->getId(),
|
||||||
'names' => $rooms[0]->getNames(),
|
'names' => $places[0]->getName(),
|
||||||
'users' => $rooms[0]->getUsers()
|
'users' => $places[0]->getUser()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/map/api/get_all_editions')]
|
||||||
|
public function getEditions(EditionRepository $rep): JsonResponse
|
||||||
|
{
|
||||||
|
$edits = $rep->getAllEditions();
|
||||||
|
if (sizeof($edits)<1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$listEdits = new ArrayCollection();
|
||||||
|
foreach ($edits as $edit){
|
||||||
|
$listEdits[] = $this->json([
|
||||||
|
'id' => $edit->getId(),
|
||||||
|
'mode' => $edit->getMode(),
|
||||||
|
'name' => $edit->getNamePlace(),
|
||||||
|
'idPlace' => $edit->getIdPlace(),
|
||||||
|
'value' => $edit->getValue()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return $listEdits;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/map/api/set_edition')]
|
||||||
|
public function setEdition(PlaceRepository $rep, string $mode, int $idPlace, string $value): bool
|
||||||
|
{
|
||||||
|
$edit = new Edition();
|
||||||
|
return $edit->setEdition($rep, $mode, $idPlace, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/map/api/remove_edition')]
|
||||||
|
public function removeEdition(EditionRepository $rep, int $id): bool
|
||||||
|
{
|
||||||
|
$edit = $rep->findEditionById($id);
|
||||||
|
if ($edit == null) {return false;}
|
||||||
|
$rep->remove($edit);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/map/api/del_place_name')]
|
||||||
|
public function delPlaceName(PlaceRepository $rep, int $id, string $value): bool
|
||||||
|
{
|
||||||
|
$places = $rep->findPlaceById($id);
|
||||||
|
if (sizeof($places)!=1) { return null; }
|
||||||
|
else {
|
||||||
|
$places[0]->removeName($value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[Route('/map/api/add_place_name')]
|
||||||
|
public function addPlaceName(PlaceRepository $rep, int $id, string $value): bool
|
||||||
|
{
|
||||||
|
$places = $rep->findPlaceById($id);
|
||||||
|
if (sizeof($places)!=1) { return null; }
|
||||||
|
else {
|
||||||
|
$places[0]->addName($value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[Route('/map/api/del_room_user_name')]
|
||||||
|
public function delRoomUserName(PlaceRepository $rep, int $id, string $value): bool
|
||||||
|
{
|
||||||
|
$rooms = $rep->findPlaceById($id);
|
||||||
|
if (sizeof($rooms)!=1) { return null; }
|
||||||
|
else {
|
||||||
|
$rooms[0]->removeRoomUser($value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[Route('/map/api/add_room_user_name')]
|
||||||
|
public function addRoomUserName(PlaceRepository $rep, int $id, string $value): bool
|
||||||
|
{
|
||||||
|
$rooms = $rep->findPlaceById($id);
|
||||||
|
if (sizeof($rooms)!=1) { return null; }
|
||||||
|
else {
|
||||||
|
$rooms[0]->addRoomUser($value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use App\Repository\CorridorRepository;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: CorridorRepository::class)]
|
|
||||||
class Corridor extends Place
|
|
||||||
{
|
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Floor::class, inversedBy: "corridors")]
|
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
|
||||||
private $floor;
|
|
||||||
|
|
||||||
public function getFloor(): ?Floor
|
|
||||||
{
|
|
||||||
return $this->floor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFloor(?Floor $floor): self
|
|
||||||
{
|
|
||||||
$this->floor = $floor;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -20,8 +20,8 @@ class Cylinder
|
|||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
private $cylinderbase;
|
private $cylinderbase;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Room::class, inversedBy: "CylinderRepresentation")]
|
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "CylinderRepresentation")]
|
||||||
private $room;
|
private $place;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
@ -52,14 +52,14 @@ class Cylinder
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRoom(): ?Room
|
public function getPlace(): ?Place
|
||||||
{
|
{
|
||||||
return $this->room;
|
return $this->place;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setRoom(?Room $room): self
|
public function setPlace(?Place $place): self
|
||||||
{
|
{
|
||||||
$this->room = $room;
|
$this->place = $place;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
90
src/Entity/Edition.php
Normal file
90
src/Entity/Edition.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\EditionRepository;
|
||||||
|
use App\Repository\PlaceRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: EditionRepository::class)]
|
||||||
|
class Edition
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column(type: "integer")]
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\Column(type: "string")]
|
||||||
|
private $mode;
|
||||||
|
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\Column(type: "int")]
|
||||||
|
private $idPlace;
|
||||||
|
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\Column(type: "string")]
|
||||||
|
private $namePlace;
|
||||||
|
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\Column(type: "string")]
|
||||||
|
private $val;
|
||||||
|
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMode(): ?string
|
||||||
|
{ return $this->mode; }
|
||||||
|
public function setMode(string $mode): self
|
||||||
|
{
|
||||||
|
$this->mode = $mode;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdPlace(): ?int
|
||||||
|
{ return $this->idPlace; }
|
||||||
|
public function setIdPlace(int $id): self
|
||||||
|
{
|
||||||
|
$this->idPlace = $id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNamePlace(): ?string
|
||||||
|
{ return $this->namePlace; }
|
||||||
|
public function setNamePlace(string $name): self
|
||||||
|
{
|
||||||
|
$this->NamePlace = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getValue(): ?string
|
||||||
|
{ return $this->val; }
|
||||||
|
public function setValue(string $val): self
|
||||||
|
{
|
||||||
|
$this->val = $val;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setEdition(PlaceRepository $rep, string $mode, int $id, string $val): self
|
||||||
|
{
|
||||||
|
$place = $rep->findPlaceById($id);
|
||||||
|
if ($place==null) { return null; }
|
||||||
|
$names = $place->getName();
|
||||||
|
$name = '';
|
||||||
|
foreach ($names as $n) {
|
||||||
|
$name = $name + $n + ", " ;
|
||||||
|
}
|
||||||
|
$this->mode = $mode;
|
||||||
|
$this->idPlace = $id;
|
||||||
|
$this->namePlace = $name;
|
||||||
|
$this->val = $val;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -15,16 +15,20 @@ class Floor
|
|||||||
#[ORM\Column(type: "integer")]
|
#[ORM\Column(type: "integer")]
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\Column(type: "integer")]
|
||||||
|
private $altitude;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Building::class, inversedBy: "floors")]
|
#[ORM\ManyToOne(targetEntity: Building::class, inversedBy: "floors")]
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
private $building;
|
private $building;
|
||||||
|
|
||||||
#[ORM\OneToMany(targetEntity: Corridor::class, mappedBy: "floor")]
|
#[ORM\ManyToMany(targetEntity: Place::class, mappedBy: "floors")]
|
||||||
private $corridors;
|
private $places;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->corridors = new ArrayCollection();
|
$this->places = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
@ -40,34 +44,43 @@ class Floor
|
|||||||
public function setBuilding(?Building $building): self
|
public function setBuilding(?Building $building): self
|
||||||
{
|
{
|
||||||
$this->building = $building;
|
$this->building = $building;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAltitude(): ?int
|
||||||
|
{
|
||||||
|
return $this->altitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAltitude(int $altitude): self
|
||||||
|
{
|
||||||
|
$this->altitude = $altitude;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Corridor>
|
* @return Collection<int, Place>
|
||||||
*/
|
*/
|
||||||
public function getCorridors(): Collection
|
public function getPlaces(): Collection
|
||||||
{
|
{
|
||||||
return $this->corridors;
|
return $this->places;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addCorridor(Corridor $corridor): self
|
public function addPlace(Place $place): self
|
||||||
{
|
{
|
||||||
if (!$this->corridors->contains($corridor)) {
|
if (!$this->places->contains($place)) {
|
||||||
$this->corridors[] = $corridor;
|
$this->places[] = $place;
|
||||||
$corridor->setFloor($this);
|
$place->setFloor($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeCorridor(Corridor $corridor): self
|
public function removePlace(Place $place): self
|
||||||
{
|
{
|
||||||
if ($this->corridors->removeElement($corridor)) {
|
if ($this->places->removeElement($place)) {
|
||||||
// set the owning side to null (unless already changed)
|
// set the owning side to null (unless already changed)
|
||||||
if ($corridor->getFloor() === $this) {
|
if ($place->getFloor() === $this) {
|
||||||
$corridor->setFloor(null);
|
$place->setFloor(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,10 +8,10 @@ use Doctrine\Common\Collections\Collection;
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: PlaceRepository::class)]
|
#[ORM\Entity(repositoryClass: PlaceRepository::class)]
|
||||||
#[ORM\MappedSuperclass]
|
// #[ORM\MappedSuperclass]
|
||||||
#[ORM\InheritanceType("JOINED")]
|
// #[ORM\InheritanceType("JOINED")]
|
||||||
#[ORM\DiscriminatorColumn(name: "type", type: "string")]
|
// #[ORM\DiscriminatorColumn(name: "type", type: "string")]
|
||||||
#[ORM\DiscriminatorMap(["room" => Room::class, "corridor" => Corridor::class])]
|
// #[ORM\DiscriminatorMap(["room" => Room::class, "corridor" => Corridor::class])]
|
||||||
class Place
|
class Place
|
||||||
{
|
{
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
@ -19,19 +19,44 @@ class Place
|
|||||||
#[ORM\Column(type: "integer")]
|
#[ORM\Column(type: "integer")]
|
||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
#[ORM\ManyToMany(targetEntity: Place::class, inversedBy: "connectedPlaces")]
|
#[ORM\Type]
|
||||||
private $connection;
|
#[ORM\Column(type: "string")]
|
||||||
|
// Either 'C'orridor , 'S'tairs , 'E'levator or 'R'oom
|
||||||
#[ORM\ManyToMany(targetEntity: Place::class, mappedBy: "connection")]
|
private $type;
|
||||||
private $connectedPlaces;
|
|
||||||
|
|
||||||
#[ORM\OneToMany(targetEntity: PlaceName::class, mappedBy: "place")]
|
#[ORM\OneToMany(targetEntity: PlaceName::class, mappedBy: "place")]
|
||||||
private $names;
|
private $names;
|
||||||
|
#[ORM\OneToMany(targetEntity: RoomUserName::class, mappedBy: "place")]
|
||||||
|
private $users;
|
||||||
|
|
||||||
|
#[ORM\ManyToMany(targetEntity: Floor::class, inversedBy: "places")]
|
||||||
|
private $floors;
|
||||||
|
|
||||||
|
#[ORM\ManyToMany(targetEntity: Place::class, inversedBy: "connectedPlaces")]
|
||||||
|
private $connection;
|
||||||
|
#[ORM\ManyToMany(targetEntity: Place::class, mappedBy: "connection")]
|
||||||
|
private $connectedPlaces;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(targetEntity: ThreeDObjectFile::class, mappedBy: "place")]
|
||||||
|
private $ComplexRepresentation;
|
||||||
|
#[ORM\OneToMany(targetEntity: Polyhedron::class, mappedBy: "place")]
|
||||||
|
private $PolyhedronRepresentation;
|
||||||
|
#[ORM\OneToMany(targetEntity: Cylinder::class, mappedBy: "place")]
|
||||||
|
private $CylinderRepresentation;
|
||||||
|
#[ORM\OneToMany(targetEntity: PolySurface::class, mappedBy: "place")]
|
||||||
|
private $PolySurfaceRepresentation;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->connection = new ArrayCollection();
|
$this->connection = new ArrayCollection();
|
||||||
$this->connectedPlaces = new ArrayCollection();
|
$this->connectedPlaces = new ArrayCollection();
|
||||||
|
$this->names = new ArrayCollection();
|
||||||
|
$this->users = new ArrayCollection();
|
||||||
|
$this->floors = new ArrayCollection();
|
||||||
|
$this->ComplexRepresentation = new ArrayCollection();
|
||||||
|
$this->PolyhedronRepresentation = new ArrayCollection();
|
||||||
|
$this->CylinderRepresentation = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
@ -39,6 +64,85 @@ class Place
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getType(): ?string
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
public function setType(string $type): bool
|
||||||
|
{
|
||||||
|
if ($type == 'C' or $type == 'S' or $type == 'E' or $type == 'R') {
|
||||||
|
$this->type = $type;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, self>
|
||||||
|
*/
|
||||||
|
public function getNames(): Collection
|
||||||
|
{
|
||||||
|
return $this->names;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addName(self $name): self
|
||||||
|
{
|
||||||
|
if (!$this->names->contains($name)) {
|
||||||
|
$this->names[] = $name;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeName(self $name): self
|
||||||
|
{
|
||||||
|
$this->names->removeElement($name);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, self>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getRoomUsers(): Collection
|
||||||
|
{
|
||||||
|
return $this->users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addRoomUser(self $user): self
|
||||||
|
{
|
||||||
|
if (!$this->users->contains($user)) {
|
||||||
|
$this->users[] = $user;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeRoomUser(self $user): self
|
||||||
|
{
|
||||||
|
$this->users->removeElement($user);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, ThreeDObjectFile>
|
||||||
|
*/
|
||||||
|
public function getFloors(): Collection
|
||||||
|
{
|
||||||
|
return $this->floors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addFloor(self $floor): self
|
||||||
|
{
|
||||||
|
if (!$this->floors->contains($floor)) {
|
||||||
|
$this->floors[] = $floor;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeFloor(self $floor): self
|
||||||
|
{
|
||||||
|
$this->floors->removeElement($floor);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, self>
|
* @return Collection<int, self>
|
||||||
*/
|
*/
|
||||||
@ -52,14 +156,12 @@ class Place
|
|||||||
if (!$this->connection->contains($connection)) {
|
if (!$this->connection->contains($connection)) {
|
||||||
$this->connection[] = $connection;
|
$this->connection[] = $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeConnection(self $connection): self
|
public function removeConnection(self $connection): self
|
||||||
{
|
{
|
||||||
$this->connection->removeElement($connection);
|
$this->connection->removeElement($connection);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +179,6 @@ class Place
|
|||||||
$this->connectedPlaces[] = $connectedPlace;
|
$this->connectedPlaces[] = $connectedPlace;
|
||||||
$connectedPlace->addConnection($this);
|
$connectedPlace->addConnection($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +187,164 @@ class Place
|
|||||||
if ($this->connectedPlaces->removeElement($connectedPlace)) {
|
if ($this->connectedPlaces->removeElement($connectedPlace)) {
|
||||||
$connectedPlace->removeConnection($this);
|
$connectedPlace->removeConnection($this);
|
||||||
}
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, ThreeDObjectFile>
|
||||||
|
*/
|
||||||
|
public function getComplexRepresentation(): Collection
|
||||||
|
{
|
||||||
|
return $this->ComplexRepresentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addComplexRepresentation(ThreeDObjectFile $complexRepresentation): self
|
||||||
|
{
|
||||||
|
if (!$this->ComplexRepresentation->contains($complexRepresentation)) {
|
||||||
|
$this->ComplexRepresentation[] = $complexRepresentation;
|
||||||
|
$complexRepresentation->setRoom($this);
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeComplexRepresentation(ThreeDObjectFile $complexRepresentation): self
|
||||||
|
{
|
||||||
|
if ($this->ComplexRepresentation->removeElement($complexRepresentation)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($complexRepresentation->getRoom() === $this) {
|
||||||
|
$complexRepresentation->setRoom(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Polyhedron>
|
||||||
|
*/
|
||||||
|
public function getPolyhedronRepresentation(): Collection
|
||||||
|
{
|
||||||
|
return $this->PolyhedronRepresentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPolyhedronRepresentation(Polyhedron $polyhedronRepresentation): self
|
||||||
|
{
|
||||||
|
if (!$this->PolyhedronRepresentation->contains($polyhedronRepresentation)) {
|
||||||
|
$this->PolyhedronRepresentation[] = $polyhedronRepresentation;
|
||||||
|
$polyhedronRepresentation->setRoom($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePolyhedronRepresentation(Polyhedron $polyhedronRepresentation): self
|
||||||
|
{
|
||||||
|
if ($this->PolyhedronRepresentation->removeElement($polyhedronRepresentation)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($polyhedronRepresentation->getRoom() === $this) {
|
||||||
|
$polyhedronRepresentation->setRoom(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Cylinder>
|
||||||
|
*/
|
||||||
|
public function getCylinderRepresentation(): Collection
|
||||||
|
{
|
||||||
|
return $this->CylinderRepresentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCylinderRepresentation(Cylinder $cylinderRepresentation): self
|
||||||
|
{
|
||||||
|
if (!$this->CylinderRepresentation->contains($cylinderRepresentation)) {
|
||||||
|
$this->CylinderRepresentation[] = $cylinderRepresentation;
|
||||||
|
$cylinderRepresentation->setRoom($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeCylinderRepresentation(Cylinder $cylinderRepresentation): self
|
||||||
|
{
|
||||||
|
if ($this->CylinderRepresentation->removeElement($cylinderRepresentation)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($cylinderRepresentation->getRoom() === $this) {
|
||||||
|
$cylinderRepresentation->setRoom(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, PolySurface>
|
||||||
|
*/
|
||||||
|
public function getPolySurfaceRepresentation(): Collection
|
||||||
|
{
|
||||||
|
return $this->PolySurfaceRepresentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPolySurfaceRepresentation(PolySurface $polySurfaceRepresentation): self
|
||||||
|
{
|
||||||
|
if (!$this->PolySurfaceRepresentation->contains($polySurfaceRepresentation)) {
|
||||||
|
$this->PolySurfaceRepresentation[] = $polySurfaceRepresentation;
|
||||||
|
$polySurfaceRepresentation->setRoom($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePolySurfaceRepresentation(PolySurface $polySurfaceRepresentation): self
|
||||||
|
{
|
||||||
|
if ($this->PolySurfaceRepresentation->removeElement($polySurfaceRepresentation)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($polySurfaceRepresentation->getRoom() === $this) {
|
||||||
|
$polySurfaceRepresentation->setRoom(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getTwoDRepresentation(string $representation, int $alt) : array
|
||||||
|
{
|
||||||
|
if ($representation=='Cylinder') {
|
||||||
|
$rep = $this->getCylinderRepresentation();
|
||||||
|
if ($rep != null){
|
||||||
|
$repPoints = $rep->getCylinderbase()->getPolygonpoint(); //Points in repository format
|
||||||
|
$Points = new ArrayCollection();
|
||||||
|
foreach ($repPoints as $p) {
|
||||||
|
$xy=array([$p->getX(), $p->getY()]);
|
||||||
|
if (!$Points->contains($xy)){
|
||||||
|
$Points[] = $xy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Points;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($representation=='PolySurface') {
|
||||||
|
$rep = $this->getPolySurfaceRepresentation();
|
||||||
|
if ($rep != null){
|
||||||
|
$repPoints = $rep->getPolysurfaceComponent()->getPolygonpoint(); //Points in repository format
|
||||||
|
$Points = new ArrayCollection();
|
||||||
|
foreach ($repPoints as $p) {
|
||||||
|
$xy=array([$p->getX(), $p->getY()]);
|
||||||
|
if (!$Points->contains($xy)){
|
||||||
|
$Points[] = $xy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Points;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: PlaceNamenRepository::class)]
|
#[ORM\Entity(repositoryClass: PlaceNameRepository::class)]
|
||||||
class PlaceName
|
class PlaceName
|
||||||
{
|
{
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
@ -18,58 +18,23 @@ class PlaceName
|
|||||||
#[ORM\Column(type: "string")]
|
#[ORM\Column(type: "string")]
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "names")]
|
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "id")]
|
||||||
private $room;
|
private $place;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->polyhedronface = new ArrayCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getPlace(): ?Place
|
||||||
* @return Collection<int, PlaneSurface>
|
|
||||||
*/
|
|
||||||
public function getPolyhedronface(): Collection
|
|
||||||
{
|
{
|
||||||
return $this->polyhedronface;
|
return $this->place;
|
||||||
}
|
}
|
||||||
|
public function setPlace(?Place $place): self
|
||||||
public function addPolyhedronface(PlaneSurface $polyhedronface): self
|
|
||||||
{
|
{
|
||||||
if (!$this->polyhedronface->contains($polyhedronface)) {
|
$this->place = $place;
|
||||||
$this->polyhedronface[] = $polyhedronface;
|
|
||||||
$polyhedronface->setPolyhedron($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removePolyhedronface(PlaneSurface $polyhedronface): self
|
|
||||||
{
|
|
||||||
if ($this->polyhedronface->removeElement($polyhedronface)) {
|
|
||||||
// set the owning side to null (unless already changed)
|
|
||||||
if ($polyhedronface->getPolyhedron() === $this) {
|
|
||||||
$polyhedronface->setPolyhedron(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRoom(): ?Room
|
|
||||||
{
|
|
||||||
return $this->room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setRoom(?Room $room): self
|
|
||||||
{
|
|
||||||
$this->room = $room;
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +42,9 @@ class PlaceName
|
|||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setName(?string $name): self
|
public function setName(?string $name): self
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,8 @@ class PolySurface
|
|||||||
#[ORM\OneToMany(targetEntity: PlaneSurface::class, mappedBy: "polySurface")]
|
#[ORM\OneToMany(targetEntity: PlaneSurface::class, mappedBy: "polySurface")]
|
||||||
private $polysurfaceComponent;
|
private $polysurfaceComponent;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Corridor::class)]
|
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "PolySurfaceRepresentation")]
|
||||||
private $SurfaceRepresentation;
|
private $place;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -61,14 +61,14 @@ class PolySurface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSurfaceRepresentation(): ?Corridor
|
public function getPlace(): ?Place
|
||||||
{
|
{
|
||||||
return $this->SurfaceRepresentation;
|
return $this->place;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSurfaceRepresentation(?Corridor $SurfaceRepresentation): self
|
public function setPlace(?Place $place): self
|
||||||
{
|
{
|
||||||
$this->SurfaceRepresentation = $SurfaceRepresentation;
|
$this->place = $place;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,8 @@ class Polyhedron
|
|||||||
#[ORM\OneToMany(targetEntity: PlaneSurface::class, mappedBy: "polyhedron")]
|
#[ORM\OneToMany(targetEntity: PlaneSurface::class, mappedBy: "polyhedron")]
|
||||||
private $polyhedronface;
|
private $polyhedronface;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Room::class, inversedBy: "PolyhedronRepresentation")]
|
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "PolyhedronRepresentation")]
|
||||||
private $room;
|
private $place;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -61,14 +61,14 @@ class Polyhedron
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRoom(): ?Room
|
public function getPlace(): ?Place
|
||||||
{
|
{
|
||||||
return $this->room;
|
return $this->place;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setRoom(?Room $room): self
|
public function setPlace(?Place $place): self
|
||||||
{
|
{
|
||||||
$this->room = $room;
|
$this->place = $place;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,120 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use App\Repository\RoomRepository;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: RoomRepository::class)]
|
|
||||||
class Room extends Place
|
|
||||||
{
|
|
||||||
|
|
||||||
#[ORM\OneToMany(targetEntity: ThreeDObjectFile::class, mappedBy: "room")]
|
|
||||||
private $ComplexRepresentation;
|
|
||||||
|
|
||||||
#[ORM\OneToMany(targetEntity: Polyhedron::class, mappedBy: "room")]
|
|
||||||
private $PolyhedronRepresentation;
|
|
||||||
|
|
||||||
#[ORM\OneToMany(targetEntity: Cylinder::class, mappedBy: "room")]
|
|
||||||
private $CylinderRepresentation;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
$this->ComplexRepresentation = new ArrayCollection();
|
|
||||||
$this->PolyhedronRepresentation = new ArrayCollection();
|
|
||||||
$this->CylinderRepresentation = new ArrayCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection<int, ThreeDObjectFile>
|
|
||||||
*/
|
|
||||||
public function getComplexRepresentation(): Collection
|
|
||||||
{
|
|
||||||
return $this->ComplexRepresentation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addComplexRepresentation(ThreeDObjectFile $complexRepresentation): self
|
|
||||||
{
|
|
||||||
if (!$this->ComplexRepresentation->contains($complexRepresentation)) {
|
|
||||||
$this->ComplexRepresentation[] = $complexRepresentation;
|
|
||||||
$complexRepresentation->setRoom($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeComplexRepresentation(ThreeDObjectFile $complexRepresentation): self
|
|
||||||
{
|
|
||||||
if ($this->ComplexRepresentation->removeElement($complexRepresentation)) {
|
|
||||||
// set the owning side to null (unless already changed)
|
|
||||||
if ($complexRepresentation->getRoom() === $this) {
|
|
||||||
$complexRepresentation->setRoom(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection<int, Polyhedron>
|
|
||||||
*/
|
|
||||||
public function getPolyhedronRepresentation(): Collection
|
|
||||||
{
|
|
||||||
return $this->PolyhedronRepresentation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addPolyhedronRepresentation(Polyhedron $polyhedronRepresentation): self
|
|
||||||
{
|
|
||||||
if (!$this->PolyhedronRepresentation->contains($polyhedronRepresentation)) {
|
|
||||||
$this->PolyhedronRepresentation[] = $polyhedronRepresentation;
|
|
||||||
$polyhedronRepresentation->setRoom($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removePolyhedronRepresentation(Polyhedron $polyhedronRepresentation): self
|
|
||||||
{
|
|
||||||
if ($this->PolyhedronRepresentation->removeElement($polyhedronRepresentation)) {
|
|
||||||
// set the owning side to null (unless already changed)
|
|
||||||
if ($polyhedronRepresentation->getRoom() === $this) {
|
|
||||||
$polyhedronRepresentation->setRoom(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection<int, Cylinder>
|
|
||||||
*/
|
|
||||||
public function getCylinderRepresentation(): Collection
|
|
||||||
{
|
|
||||||
return $this->CylinderRepresentation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addCylinderRepresentation(Cylinder $cylinderRepresentation): self
|
|
||||||
{
|
|
||||||
if (!$this->CylinderRepresentation->contains($cylinderRepresentation)) {
|
|
||||||
$this->CylinderRepresentation[] = $cylinderRepresentation;
|
|
||||||
$cylinderRepresentation->setRoom($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeCylinderRepresentation(Cylinder $cylinderRepresentation): self
|
|
||||||
{
|
|
||||||
if ($this->CylinderRepresentation->removeElement($cylinderRepresentation)) {
|
|
||||||
// set the owning side to null (unless already changed)
|
|
||||||
if ($cylinderRepresentation->getRoom() === $this) {
|
|
||||||
$cylinderRepresentation->setRoom(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
49
src/Entity/RoomUsersName.php
Normal file
49
src/Entity/RoomUsersName.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: RoomUserRepository::class)]
|
||||||
|
class RoomUserName
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column(type: "integer")]
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
#[ORM\Column(type: "string")]
|
||||||
|
private $userName;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "id")]
|
||||||
|
private $place;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPlace(): ?Place
|
||||||
|
{
|
||||||
|
return $this->place;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPlace(?Place $place): self
|
||||||
|
{
|
||||||
|
$this->place = $place;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserName(): ?string
|
||||||
|
{
|
||||||
|
return $this->userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUserName(?string $name): self
|
||||||
|
{
|
||||||
|
$this->userName = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,8 +16,8 @@ class ThreeDObjectFile
|
|||||||
#[ORM\Column(type: "string", length: 255)]
|
#[ORM\Column(type: "string", length: 255)]
|
||||||
private $filename;
|
private $filename;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Room::class, inversedBy: "ComplexRepresentation")]
|
#[ORM\ManyToOne(targetEntity: Place::class, inversedBy: "ComplexRepresentation")]
|
||||||
private $room;
|
private $place;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
@ -36,14 +36,14 @@ class ThreeDObjectFile
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRoom(): ?Room
|
public function getPlace(): ?Place
|
||||||
{
|
{
|
||||||
return $this->room;
|
return $this->place;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setRoom(?Room $room): self
|
public function setPlace(?Place $place): self
|
||||||
{
|
{
|
||||||
$this->room = $room;
|
$this->place = $place;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repository;
|
|
||||||
|
|
||||||
use App\Entity\Corridor;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends ServiceEntityRepository<Corridor>
|
|
||||||
*
|
|
||||||
* @method Corridor|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method Corridor|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method Corridor[] findAll()
|
|
||||||
* @method Corridor[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
class CorridorRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
public function __construct(ManagerRegistry $registry)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, Corridor::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function add(Corridor $entity, bool $flush = false): void
|
|
||||||
{
|
|
||||||
$this->getEntityManager()->persist($entity);
|
|
||||||
|
|
||||||
if ($flush) {
|
|
||||||
$this->getEntityManager()->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function remove(Corridor $entity, bool $flush = false): void
|
|
||||||
{
|
|
||||||
$this->getEntityManager()->remove($entity);
|
|
||||||
|
|
||||||
if ($flush) {
|
|
||||||
$this->getEntityManager()->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return Corridor[] Returns an array of Corridor objects
|
|
||||||
// */
|
|
||||||
// public function findByExampleField($value): array
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('c')
|
|
||||||
// ->andWhere('c.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->orderBy('c.id', 'ASC')
|
|
||||||
// ->setMaxResults(10)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function findOneBySomeField($value): ?Corridor
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('c')
|
|
||||||
// ->andWhere('c.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getOneOrNullResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
64
src/Repository/EditionRepository.php
Normal file
64
src/Repository/EditionRepository.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Edition;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<Edition>
|
||||||
|
*
|
||||||
|
* @method Edition|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method Edition|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method Edition[] findAll()
|
||||||
|
* @method Edition[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class EditionRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Edition::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add(Edition $entity, bool $flush = false): void
|
||||||
|
{
|
||||||
|
$this->getEntityManager()->persist($entity);
|
||||||
|
|
||||||
|
if ($flush) {
|
||||||
|
$this->getEntityManager()->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function remove(Edition $entity, bool $flush = false): void
|
||||||
|
{
|
||||||
|
$this->getEntityManager()->remove($entity);
|
||||||
|
|
||||||
|
if ($flush) {
|
||||||
|
$this->getEntityManager()->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Edition[] Returns an array of Edition objects
|
||||||
|
*/
|
||||||
|
public function getAllEditions(): array
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('f')
|
||||||
|
->orderBy('f.id', 'ASC')
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function findEditionById(int $id): ?Edition
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('f')
|
||||||
|
->andWhere('f.id = :val')
|
||||||
|
->setParameter('val', $id)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -40,13 +40,26 @@ class PlaceRepository extends ServiceEntityRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Place[] Returns an array of Place objects having connection with Corrido
|
* @return Place[] Returns an array of Place objects
|
||||||
*/
|
*/
|
||||||
public function findPlaceConnectedTo($value): array
|
public function findPlaceByName(string $name): array
|
||||||
{
|
{
|
||||||
return $this->createQueryBuilder('p')
|
return $this->createQueryBuilder('p')
|
||||||
->andWhere('p.connectedPlace = :val')
|
->andWhere('LOWER(p.name) = :val')
|
||||||
->setParameter('val', $value)
|
->setParameter('val', strtolower($name))
|
||||||
|
->orderBy('p.id', 'ASC')
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return Place[] Returns an array of Place objects
|
||||||
|
*/
|
||||||
|
public function findPlaceById(int $id): array
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('p')
|
||||||
|
->andWhere('p.id = :val')
|
||||||
|
->setParameter('val', $id)
|
||||||
->orderBy('p.id', 'ASC')
|
->orderBy('p.id', 'ASC')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getResult()
|
->getResult()
|
||||||
|
|||||||
@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repository;
|
|
||||||
|
|
||||||
use App\Entity\Room;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends ServiceEntityRepository<Room>
|
|
||||||
*
|
|
||||||
* @method Room|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method Room|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method Room[] findAll()
|
|
||||||
* @method Room[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
class RoomRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
public function __construct(ManagerRegistry $registry)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, Room::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function add(Room $entity, bool $flush = false): void
|
|
||||||
{
|
|
||||||
$this->getEntityManager()->persist($entity);
|
|
||||||
|
|
||||||
if ($flush) {
|
|
||||||
$this->getEntityManager()->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function remove(Room $entity, bool $flush = false): void
|
|
||||||
{
|
|
||||||
$this->getEntityManager()->remove($entity);
|
|
||||||
|
|
||||||
if ($flush) {
|
|
||||||
$this->getEntityManager()->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Room[] Returns an array of Room objects
|
|
||||||
*/
|
|
||||||
public function findRoomByName(string $name): array
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('r')
|
|
||||||
->andWhere('r.name.lower() = :val')
|
|
||||||
->setParameter('val', $name.lower())
|
|
||||||
->orderBy('r.id', 'ASC')
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return Room[] Returns an array of Room objects
|
|
||||||
*/
|
|
||||||
public function findRoomById(int $id): array
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('r')
|
|
||||||
->andWhere('r.id = :val')
|
|
||||||
->setParameter('val', $id)
|
|
||||||
->orderBy('r.id', 'ASC')
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
// public function findOneBySomeField($value): ?Room
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('r')
|
|
||||||
// ->andWhere('r.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getOneOrNullResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user