Images for NotConserved
This commit is contained in:
parent
f573b4deca
commit
68854f875b
@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\NotConserved;
|
||||
use App\Entity\Bibliography;
|
||||
use App\Entity\Image;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
@ -49,6 +50,13 @@ class NotConservedController extends AbstractController
|
||||
|
||||
$notConserved->setLat($coordinates['lat']);
|
||||
$notConserved->setLng($coordinates['lng']);
|
||||
$repo = $em->getRepository(Image::class);
|
||||
$images = $repo->findBy(
|
||||
['notConserved' => $notConserved->getId()],
|
||||
['sequence' => 'ASC']
|
||||
);
|
||||
|
||||
$notConserved->setImages($images);
|
||||
|
||||
return $this->json(
|
||||
$notConserved,
|
||||
|
@ -59,7 +59,7 @@ class Finding implements \JsonSerializable
|
||||
private ?array $bibliography = null;
|
||||
|
||||
/**
|
||||
* @var Bibliography[] $images
|
||||
* @var Image[] $images
|
||||
*/
|
||||
private ?array $images = null;
|
||||
|
||||
|
@ -31,6 +31,9 @@ class Image implements \JsonSerializable
|
||||
#[ORM\Column(name: 'rinvenimento', type: Types::BIGINT, nullable: true)]
|
||||
private ?string $finding = null;
|
||||
|
||||
#[ORM\Column(name: 'non_conserv', type: Types::BIGINT, nullable: true)]
|
||||
private ?string $notConserved = null;
|
||||
|
||||
#[ORM\Column(name: 'ordine', type: Types::SMALLINT)]
|
||||
private ?int $sequence = null;
|
||||
|
||||
@ -109,6 +112,18 @@ class Image implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNotConserved(): ?string
|
||||
{
|
||||
return $this->notConserved;
|
||||
}
|
||||
|
||||
public function setNotConserved(?string $notConserved): static
|
||||
{
|
||||
$this->notConserved = $notConserved;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSequence(): ?int
|
||||
{
|
||||
return $this->sequence;
|
||||
|
@ -40,6 +40,11 @@ class NotConserved implements \JsonSerializable
|
||||
#[ORM\Column(name: 'autore_scheda', length: 100, nullable: true)]
|
||||
private ?string $author = null;
|
||||
|
||||
/**
|
||||
* @var Image[] $images
|
||||
*/
|
||||
private ?array $images = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@ -148,6 +153,24 @@ class NotConserved implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Image[]
|
||||
*/
|
||||
public function getImages(): array
|
||||
{
|
||||
return $this->images;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Image[] $images
|
||||
*/
|
||||
public function setImages(array $images): static
|
||||
{
|
||||
$this->images = $images;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
@ -159,6 +182,7 @@ class NotConserved implements \JsonSerializable
|
||||
'shortDescription' => $this->shortDescription,
|
||||
'author' => $this->author,
|
||||
'bibliography' => $this->bibliographies,
|
||||
'images' => $this->images,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user