Debug de l'API

This commit is contained in:
Kouril42
2023-02-14 01:46:32 +01:00
parent 32333be41e
commit 5e75888ab7
9 changed files with 248 additions and 117 deletions
+44 -10
View File
@@ -45,7 +45,7 @@ class Place
#[ORM\OneToMany(targetEntity: PolySurface::class, mappedBy: "place")]
private $PolySurfaceRepresentation;
#[ORM\ManyToOne(targetEntity: Edition::class, inversedBy: "editedPlace")]
#[ORM\OneToMany(targetEntity: Edition::class, mappedBy: "editedPlace")]
private $editions;
public function __construct()
@@ -86,7 +86,16 @@ class Place
return $this->names;
}
public function addName(self $name): self
public function getJoinedNames(): array
{
$names = new ArrayCollection();
foreach ($this->names as $plName) {
$names[] = $plName->getName();
}
return $names->toArray();
}
public function addName(PlaceName $name): self
{
if (!$this->names->contains($name)) {
$this->names[] = $name;
@@ -94,11 +103,28 @@ class Place
return $this;
}
public function removeName(self $name): self
public function removeName(PlaceName $name): self
{
$this->names->removeElement($name);
return $this;
}
/**
* @return Collection<int, self>
*/
public function getEditions(): Collection
{ return $this->editions;
}
public function addEdition(Edition $edition): self
{ if (!$this->editions->contains($edition)) {
$this->editions[] = $edition;
}
return $this;
}
public function removeEdition(Edition $edition): self
{ $this->editions->removeElement($edition);
return $this;
}
/**
* @return Collection<int, self>
@@ -108,8 +134,16 @@ class Place
{
return $this->users;
}
public function getJoinedRoomUsersNames(): array
{
$names = new ArrayCollection();
foreach ($this->users as $roomUserName) {
$names[] = $roomUserName->getUserName();
}
return $names->toArray();
}
public function addRoomUser(self $user): self
public function addRoomUser(RoomUserName $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
@@ -117,7 +151,7 @@ class Place
return $this;
}
public function removeRoomUser(self $user): self
public function removeRoomUser(RoomUserName $user): self
{
$this->users->removeElement($user);
return $this;
@@ -317,26 +351,26 @@ class Place
public function getTwoDRepresentation(string $representation, int $alt) : array
{
if ($representation=='Cylinder') {
$rep = $this->getCylinderRepresentation();
$rep = $this->getCylinderRepresentation()[0]; //ARBITRARY
if ($rep != null){
$repPoints = $rep->getCylinderbase()->getPolygonpoint(); //Points in repository format
$Points = new ArrayCollection();
foreach ($repPoints as $p) {
$xy=array([$p->getX(), $p->getY()]);
$xy=array('x'=>$p->getX(), 'y'=>$p->getY());
if (!$Points->contains($xy)){
$Points[] = $xy;
}
}
return $Points;
return $Points->toArray();
}
}
elseif ($representation=='PolySurface') {
$rep = $this->getPolySurfaceRepresentation();
$rep = $this->getPolySurfaceRepresentation()[0]; //ARBITRARY
if ($rep != null){
$repPoints = $rep->getPolysurfaceComponent()->getPolygonpoint(); //Points in repository format
$Points = new ArrayCollection();
foreach ($repPoints as $p) {
$xy=array([$p->getX(), $p->getY()]);
$xy=array('x'=>$p->getX(), 'y'=>$p->getY());
if (!$Points->contains($xy)){
$Points[] = $xy;
}