mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 14:41:03 +01:00
Merge branch 'main' of gitlab.aliens-lyon.fr:encartes/backend
This commit is contained in:
commit
32333be41e
118
migrations/Version20230204151430.php
Normal file
118
migrations/Version20230204151430.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20230204151430 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Removed corridor and room, added editions';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE poly_surface DROP CONSTRAINT fk_a643146fdfb7db2b');
|
||||
$this->addSql('ALTER TABLE cylinder DROP CONSTRAINT fk_9b045bea54177093');
|
||||
$this->addSql('ALTER TABLE polyhedron DROP CONSTRAINT fk_768611c054177093');
|
||||
$this->addSql('ALTER TABLE three_dobject_file DROP CONSTRAINT fk_6e8c161954177093');
|
||||
$this->addSql('CREATE SEQUENCE edition_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE room_user_name_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE edition (id INT NOT NULL, mode VARCHAR(255) NOT NULL, name_place VARCHAR(255) NOT NULL, val VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE place_floor (place_id INT NOT NULL, floor_id INT NOT NULL, PRIMARY KEY(place_id, floor_id))');
|
||||
$this->addSql('CREATE INDEX IDX_1733CD0DDA6A219 ON place_floor (place_id)');
|
||||
$this->addSql('CREATE INDEX IDX_1733CD0D854679E2 ON place_floor (floor_id)');
|
||||
$this->addSql('CREATE TABLE room_user_name (id INT NOT NULL, place_id INT DEFAULT NULL, user_name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_B80BD2A6DA6A219 ON room_user_name (place_id)');
|
||||
$this->addSql('ALTER TABLE place_floor ADD CONSTRAINT FK_1733CD0DDA6A219 FOREIGN KEY (place_id) REFERENCES place (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE place_floor ADD CONSTRAINT FK_1733CD0D854679E2 FOREIGN KEY (floor_id) REFERENCES floor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE room_user_name ADD CONSTRAINT FK_B80BD2A6DA6A219 FOREIGN KEY (place_id) REFERENCES place (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE corridor DROP CONSTRAINT fk_d6dee755854679e2');
|
||||
$this->addSql('ALTER TABLE corridor DROP CONSTRAINT fk_d6dee755bf396750');
|
||||
$this->addSql('ALTER TABLE room DROP CONSTRAINT fk_729f519bbf396750');
|
||||
$this->addSql('DROP TABLE corridor');
|
||||
$this->addSql('DROP TABLE room');
|
||||
$this->addSql('DROP INDEX idx_9b045bea54177093');
|
||||
$this->addSql('ALTER TABLE cylinder RENAME COLUMN room_id TO place_id');
|
||||
$this->addSql('ALTER TABLE cylinder ADD CONSTRAINT FK_9B045BEADA6A219 FOREIGN KEY (place_id) REFERENCES place (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_9B045BEADA6A219 ON cylinder (place_id)');
|
||||
$this->addSql('ALTER TABLE floor ADD altitude INT NOT NULL');
|
||||
$this->addSql('ALTER TABLE place ADD editions_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE place ADD CONSTRAINT FK_741D53CD6BD6E9CC FOREIGN KEY (editions_id) REFERENCES edition (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_741D53CD6BD6E9CC ON place (editions_id)');
|
||||
$this->addSql('ALTER TABLE place_name DROP CONSTRAINT fk_94960eea54177093');
|
||||
$this->addSql('DROP INDEX idx_94960eea54177093');
|
||||
$this->addSql('ALTER TABLE place_name RENAME COLUMN room_id TO place_id');
|
||||
$this->addSql('ALTER TABLE place_name ADD CONSTRAINT FK_94960EEADA6A219 FOREIGN KEY (place_id) REFERENCES place (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_94960EEADA6A219 ON place_name (place_id)');
|
||||
$this->addSql('DROP INDEX idx_a643146fdfb7db2b');
|
||||
$this->addSql('ALTER TABLE poly_surface RENAME COLUMN surface_representation_id TO place_id');
|
||||
$this->addSql('ALTER TABLE poly_surface ADD CONSTRAINT FK_A643146FDA6A219 FOREIGN KEY (place_id) REFERENCES place (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_A643146FDA6A219 ON poly_surface (place_id)');
|
||||
$this->addSql('DROP INDEX idx_768611c054177093');
|
||||
$this->addSql('ALTER TABLE polyhedron RENAME COLUMN room_id TO place_id');
|
||||
$this->addSql('ALTER TABLE polyhedron ADD CONSTRAINT FK_768611C0DA6A219 FOREIGN KEY (place_id) REFERENCES place (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_768611C0DA6A219 ON polyhedron (place_id)');
|
||||
$this->addSql('DROP INDEX idx_6e8c161954177093');
|
||||
$this->addSql('ALTER TABLE three_dobject_file RENAME COLUMN room_id TO place_id');
|
||||
$this->addSql('ALTER TABLE three_dobject_file ADD CONSTRAINT FK_6E8C1619DA6A219 FOREIGN KEY (place_id) REFERENCES place (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_6E8C1619DA6A219 ON three_dobject_file (place_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE place DROP CONSTRAINT FK_741D53CD6BD6E9CC');
|
||||
$this->addSql('DROP SEQUENCE edition_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE room_user_name_id_seq CASCADE');
|
||||
$this->addSql('CREATE TABLE corridor (id INT NOT NULL, floor_id INT NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX idx_d6dee755854679e2 ON corridor (floor_id)');
|
||||
$this->addSql('CREATE TABLE room (id INT NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('ALTER TABLE corridor ADD CONSTRAINT fk_d6dee755854679e2 FOREIGN KEY (floor_id) REFERENCES floor (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE corridor ADD CONSTRAINT fk_d6dee755bf396750 FOREIGN KEY (id) REFERENCES place (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE room ADD CONSTRAINT fk_729f519bbf396750 FOREIGN KEY (id) REFERENCES place (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE place_floor DROP CONSTRAINT FK_1733CD0DDA6A219');
|
||||
$this->addSql('ALTER TABLE place_floor DROP CONSTRAINT FK_1733CD0D854679E2');
|
||||
$this->addSql('ALTER TABLE room_user_name DROP CONSTRAINT FK_B80BD2A6DA6A219');
|
||||
$this->addSql('DROP TABLE edition');
|
||||
$this->addSql('DROP TABLE place_floor');
|
||||
$this->addSql('DROP TABLE room_user_name');
|
||||
$this->addSql('ALTER TABLE cylinder DROP CONSTRAINT FK_9B045BEADA6A219');
|
||||
$this->addSql('DROP INDEX IDX_9B045BEADA6A219');
|
||||
$this->addSql('ALTER TABLE cylinder RENAME COLUMN place_id TO room_id');
|
||||
$this->addSql('ALTER TABLE cylinder ADD CONSTRAINT fk_9b045bea54177093 FOREIGN KEY (room_id) REFERENCES room (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_9b045bea54177093 ON cylinder (room_id)');
|
||||
$this->addSql('ALTER TABLE place_name DROP CONSTRAINT FK_94960EEADA6A219');
|
||||
$this->addSql('DROP INDEX IDX_94960EEADA6A219');
|
||||
$this->addSql('ALTER TABLE place_name RENAME COLUMN place_id TO room_id');
|
||||
$this->addSql('ALTER TABLE place_name ADD CONSTRAINT fk_94960eea54177093 FOREIGN KEY (room_id) REFERENCES place (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_94960eea54177093 ON place_name (room_id)');
|
||||
$this->addSql('ALTER TABLE polyhedron DROP CONSTRAINT FK_768611C0DA6A219');
|
||||
$this->addSql('DROP INDEX IDX_768611C0DA6A219');
|
||||
$this->addSql('ALTER TABLE polyhedron RENAME COLUMN place_id TO room_id');
|
||||
$this->addSql('ALTER TABLE polyhedron ADD CONSTRAINT fk_768611c054177093 FOREIGN KEY (room_id) REFERENCES room (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_768611c054177093 ON polyhedron (room_id)');
|
||||
$this->addSql('DROP INDEX IDX_741D53CD6BD6E9CC');
|
||||
$this->addSql('ALTER TABLE place DROP editions_id');
|
||||
$this->addSql('ALTER TABLE poly_surface DROP CONSTRAINT FK_A643146FDA6A219');
|
||||
$this->addSql('DROP INDEX IDX_A643146FDA6A219');
|
||||
$this->addSql('ALTER TABLE poly_surface RENAME COLUMN place_id TO surface_representation_id');
|
||||
$this->addSql('ALTER TABLE poly_surface ADD CONSTRAINT fk_a643146fdfb7db2b FOREIGN KEY (surface_representation_id) REFERENCES corridor (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_a643146fdfb7db2b ON poly_surface (surface_representation_id)');
|
||||
$this->addSql('ALTER TABLE three_dobject_file DROP CONSTRAINT FK_6E8C1619DA6A219');
|
||||
$this->addSql('DROP INDEX IDX_6E8C1619DA6A219');
|
||||
$this->addSql('ALTER TABLE three_dobject_file RENAME COLUMN place_id TO room_id');
|
||||
$this->addSql('ALTER TABLE three_dobject_file ADD CONSTRAINT fk_6e8c161954177093 FOREIGN KEY (room_id) REFERENCES room (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_6e8c161954177093 ON three_dobject_file (room_id)');
|
||||
$this->addSql('ALTER TABLE floor DROP altitude');
|
||||
}
|
||||
}
|
||||
205
src/Controller/JsonReaderController.php
Normal file
205
src/Controller/JsonReaderController.php
Normal file
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use App\Repository\SiteRepository;
|
||||
use App\Repository\BuildingRepository;
|
||||
use App\Repository\FloorRepository;
|
||||
use App\Entity\Building;
|
||||
use App\Entity\Cylinder;
|
||||
use App\Entity\Edition;
|
||||
use App\Entity\Floor;
|
||||
use App\Entity\Place;
|
||||
use App\Entity\PlaceName;
|
||||
use App\Entity\PlaneSurface;
|
||||
use App\Entity\Point;
|
||||
use App\Entity\Polyhedron;
|
||||
use App\Entity\PolySurface;
|
||||
use App\Entity\RoomUserName;
|
||||
use App\Entity\Site;
|
||||
use App\Entity\ThreeDObjectFile;
|
||||
|
||||
|
||||
class JsonReaderController extends AbstractController
|
||||
{
|
||||
#[Route('/api/debug/loadJson')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
return new Response(print_r($request,true));
|
||||
|
||||
$response = new Response();
|
||||
$response->setStatusCode(Response::HTTP_OK);
|
||||
return $response;
|
||||
}
|
||||
|
||||
#[Route('/api/debug/initialData')]
|
||||
public function init(Request $request, SiteRepository $srep, BuildingRepository $brep, FloorRepository $frep, ManagerRegistry $mr): Response
|
||||
{
|
||||
//return new Response(print_r(json_decode($request->getContent()),true));
|
||||
|
||||
$monod = new Site();
|
||||
$monod->setZeroLatitude(45.72980);
|
||||
$monod->setZeroLongitude(4.82777);
|
||||
$srep->add($monod);
|
||||
|
||||
$descartes = new Site();
|
||||
$descartes->setZeroLatitude(45.73261);
|
||||
$descartes->setZeroLongitude(4.83293);
|
||||
$srep->add($descartes);
|
||||
|
||||
$mgn1 = new Building();
|
||||
$mgn1->setSite($monod);
|
||||
$brep->add($mgn1);
|
||||
|
||||
$floors = array();
|
||||
for($i=0;$i<7;$i++){
|
||||
$floor = new Floor();
|
||||
$floor->setBuilding($mgn1);
|
||||
$floor->setAltitude(0.45*$i);
|
||||
$frep->add($floor);
|
||||
$floors[$i] = $floor;
|
||||
}
|
||||
|
||||
$data = json_decode($request->getContent(),true);
|
||||
|
||||
// Adding all the rooms
|
||||
$rooms2Data = $data['rooms2'];
|
||||
$cor2Data = $data['cor2'];
|
||||
$rooms3Data = $data['rooms3'];
|
||||
$cor3Data = $data['cor3'];
|
||||
$rooms4Data = $data['rooms4'];
|
||||
$cor4Data = $data['cor4'];
|
||||
$rooms34Data = $data['bothRooms'];
|
||||
$roomsXData = $data['allRooms'];
|
||||
|
||||
// We create the rooms
|
||||
$rooms2 = [];
|
||||
foreach($rooms2Data as $rData) {
|
||||
$rooms2[] = JsonReaderController::addRoom($rData, "R", $mr);
|
||||
}
|
||||
$cor2 = JsonReaderController::addRoom($cor2Data, "C", $mr);
|
||||
$rooms3 = [];
|
||||
foreach($rooms3Data as $rData) {
|
||||
$rooms3[] = JsonReaderController::addRoom($rData, "R", $mr);
|
||||
}
|
||||
$cor3 = JsonReaderController::addRoom($cor3Data, "C", $mr);
|
||||
$rooms4 = [];
|
||||
foreach($rooms4Data as $rData) {
|
||||
$rooms4[] = JsonReaderController::addRoom($rData, "R", $mr);
|
||||
}
|
||||
$cor4 = JsonReaderController::addRoom($cor4Data, "C", $mr);
|
||||
$rooms34 = [];
|
||||
foreach($rooms34Data as $rData) {
|
||||
$rooms34[] = JsonReaderController::addRoom($rData, "R", $mr);
|
||||
}
|
||||
$roomsX = [];
|
||||
foreach($roomsXData as $rData) {
|
||||
$roomsX[] = JsonReaderController::addRoom($rData, "R", $mr);
|
||||
}
|
||||
|
||||
|
||||
// Connect all rooms
|
||||
foreach($rooms2 as $r){
|
||||
$floors[4]->addPlace($r);
|
||||
$cor2->addConnection($r);
|
||||
}
|
||||
foreach($rooms3 as $r){
|
||||
$floors[5]->addPlace($r);
|
||||
$cor3->addConnection($r);
|
||||
}
|
||||
foreach($rooms4 as $r){
|
||||
$floors[6]->addPlace($r);
|
||||
$cor4->addConnection($r);
|
||||
}
|
||||
foreach($rooms34 as $r){
|
||||
$floors[5]->addPlace($r);
|
||||
$floors[6]->addPlace($r);
|
||||
$cor3->addConnection($r);
|
||||
$cor4->addConnection($r);
|
||||
}
|
||||
foreach($roomsX as $r){
|
||||
for($i=0;$i<7;$i++){
|
||||
$floors[$i]->addPlace($r);
|
||||
}
|
||||
$cor2->addConnection($r);
|
||||
$cor3->addConnection($r);
|
||||
$cor4->addConnection($r);
|
||||
}
|
||||
|
||||
$mr->getManager()->flush();
|
||||
|
||||
return new Response("All Done !");
|
||||
|
||||
}
|
||||
|
||||
#[Route('/api/debug/dropAllDatabaseThereIsNoWayIGotTheNameOfThisPageWrong')]
|
||||
public function dropDatabase(EntityManagerInterface $em): Response
|
||||
{
|
||||
$entityClasses = array(
|
||||
Building::class,
|
||||
Cylinder::class,
|
||||
Edition::class,
|
||||
Floor::class,
|
||||
Place::class,
|
||||
PlaceName::class,
|
||||
PlaneSurface::class,
|
||||
Point::class,
|
||||
Polyhedron::class,
|
||||
PolySurface::class,
|
||||
RoomUserName::class,
|
||||
Site::class,
|
||||
ThreeDObjectFile::class
|
||||
);
|
||||
foreach($entityClasses as $eclass){
|
||||
$repository = $em->getRepository($eclass);
|
||||
$entities = $repository->findAll();
|
||||
|
||||
foreach ($entities as $entity) {
|
||||
$em->remove($entity);
|
||||
}
|
||||
}
|
||||
$em->flush();
|
||||
|
||||
return new Response('', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function addRoom(array $room, string $roomType, ManagerRegistry $mr): Place {
|
||||
|
||||
$manager = $mr->getManager();
|
||||
|
||||
$height = (float) $room['height'];
|
||||
$z = (float) $room['z'];
|
||||
$name = $room['name'];
|
||||
$points = json_decode($room['points'],true);
|
||||
|
||||
$r = new Place();
|
||||
$r->setType($roomType);
|
||||
$cyl = new Cylinder();
|
||||
$cyl->setHeight($height);
|
||||
$cbas = new PlaneSurface();
|
||||
foreach($points as $px) {
|
||||
$p = new Point();
|
||||
$p->setX($px[0]);
|
||||
$p->setY($px[1]);
|
||||
$p->setZ($z);
|
||||
$manager->persist($p);
|
||||
$cbas->addPolygonpoint($p);
|
||||
}
|
||||
|
||||
$manager->persist($cbas);
|
||||
$cyl->setCylinderBase($cbas);
|
||||
$manager->persist($cyl);
|
||||
$r->addCylinderRepresentation($cyl);
|
||||
$manager->persist($r);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,19 +16,16 @@ class Edition
|
||||
#[ORM\Column(type: "integer")]
|
||||
private $id;
|
||||
|
||||
#[ORM\Id]
|
||||
|
||||
#[ORM\Column(type: "string")]
|
||||
private $mode;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: "int")]
|
||||
private $idPlace;
|
||||
#[ORM\OneToMany(targetEntity: Place::class, mappedBy: "editions")]
|
||||
private $editedPlace;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: "string")]
|
||||
private $namePlace;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: "string")]
|
||||
private $val;
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@ class Floor
|
||||
#[ORM\Column(type: "integer")]
|
||||
private $id;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: "integer")]
|
||||
private $altitude;
|
||||
|
||||
@ -70,7 +69,7 @@ class Floor
|
||||
{
|
||||
if (!$this->places->contains($place)) {
|
||||
$this->places[] = $place;
|
||||
$place->setFloor($this);
|
||||
$place->addFloor($this);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
@ -80,7 +79,7 @@ class Floor
|
||||
if ($this->places->removeElement($place)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($place->getFloor() === $this) {
|
||||
$place->setFloor(null);
|
||||
$place->addFloor(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@ class Place
|
||||
#[ORM\Column(type: "integer")]
|
||||
private $id;
|
||||
|
||||
#[ORM\Type]
|
||||
#[ORM\Column(type: "string")]
|
||||
// Either 'C'orridor , 'S'tairs , 'E'levator or 'R'oom
|
||||
private $type;
|
||||
@ -46,6 +45,8 @@ class Place
|
||||
#[ORM\OneToMany(targetEntity: PolySurface::class, mappedBy: "place")]
|
||||
private $PolySurfaceRepresentation;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Edition::class, inversedBy: "editedPlace")]
|
||||
private $editions;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -130,7 +131,7 @@ class Place
|
||||
return $this->floors;
|
||||
}
|
||||
|
||||
public function addFloor(self $floor): self
|
||||
public function addFloor(Floor $floor): self
|
||||
{
|
||||
if (!$this->floors->contains($floor)) {
|
||||
$this->floors[] = $floor;
|
||||
@ -138,7 +139,7 @@ class Place
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeFloor(self $floor): self
|
||||
public function removeFloor(Floor $floor): self
|
||||
{
|
||||
$this->floors->removeElement($floor);
|
||||
return $this;
|
||||
@ -262,7 +263,7 @@ class Place
|
||||
{
|
||||
if (!$this->CylinderRepresentation->contains($cylinderRepresentation)) {
|
||||
$this->CylinderRepresentation[] = $cylinderRepresentation;
|
||||
$cylinderRepresentation->setRoom($this);
|
||||
$cylinderRepresentation->setPlace($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -272,8 +273,8 @@ class Place
|
||||
{
|
||||
if ($this->CylinderRepresentation->removeElement($cylinderRepresentation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($cylinderRepresentation->getRoom() === $this) {
|
||||
$cylinderRepresentation->setRoom(null);
|
||||
if ($cylinderRepresentation->getPlace() === $this) {
|
||||
$cylinderRepresentation->setPlace(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,7 +294,7 @@ class Place
|
||||
{
|
||||
if (!$this->PolySurfaceRepresentation->contains($polySurfaceRepresentation)) {
|
||||
$this->PolySurfaceRepresentation[] = $polySurfaceRepresentation;
|
||||
$polySurfaceRepresentation->setRoom($this);
|
||||
$polySurfaceRepresentation->setPlace($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -303,8 +304,8 @@ class Place
|
||||
{
|
||||
if ($this->PolySurfaceRepresentation->removeElement($polySurfaceRepresentation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($polySurfaceRepresentation->getRoom() === $this) {
|
||||
$polySurfaceRepresentation->setRoom(null);
|
||||
if ($polySurfaceRepresentation->getPlace() === $this) {
|
||||
$polySurfaceRepresentation->setPlace(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\PolyhedronRepository;
|
||||
use App\Repository\PlaceNameRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
@ -2,11 +2,12 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\RoomUserNameRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: RoomUserRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: RoomUserNameRepository::class)]
|
||||
class RoomUserName
|
||||
{
|
||||
#[ORM\Id]
|
||||
49
src/Repository/PlaceNameRepository.php
Normal file
49
src/Repository/PlaceNameRepository.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\PlaceName;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<PlaceName>
|
||||
*/
|
||||
class PlaceNameRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, PlaceName::class);
|
||||
}
|
||||
|
||||
public function add(PlaceName $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(PlaceName $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return PlaceName[] Returns an array of PlaceName objects
|
||||
*/
|
||||
public function findPlaceNameById(int $id): array
|
||||
{
|
||||
return $this->createQueryBuilder('p')
|
||||
->andWhere('p.id = :val')
|
||||
->setParameter('val', $id)
|
||||
->orderBy('p.id', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
49
src/Repository/RoomUserNameRepository.php
Normal file
49
src/Repository/RoomUserNameRepository.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\RoomUserName;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<RoomUserName>
|
||||
*/
|
||||
class RoomUserNameRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, RoomUserName::class);
|
||||
}
|
||||
|
||||
public function add(RoomUserName $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(RoomUserName $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return RoomUserName[] Returns an array of RoomUserName objects
|
||||
*/
|
||||
public function findPlaceNameById(int $id): array
|
||||
{
|
||||
return $this->createQueryBuilder('p')
|
||||
->andWhere('p.id = :val')
|
||||
->setParameter('val', $id)
|
||||
->orderBy('p.id', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user