Compare commits
	
		
			No commits in common. "660d40909387b742e8adff6f1b0409d8427c50ab" and "42e32952d60f2e6de9a2a904160571a4e51de833" have entirely different histories.
		
	
	
		
			660d409093
			...
			42e32952d6
		
	
		
@ -1,277 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace App\Entity;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use App\Repository\ReuseRepository;
 | 
					 | 
				
			||||||
use Doctrine\DBAL\Types\Types;
 | 
					 | 
				
			||||||
use Doctrine\ORM\Mapping as ORM;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[ORM\Entity(repositoryClass: ReuseRepository::class)]
 | 
					 | 
				
			||||||
#[ORM\Table(name: 'reimpiego')]
 | 
					 | 
				
			||||||
class Reuse implements \JsonSerializable
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    #[ORM\Id]
 | 
					 | 
				
			||||||
    #[ORM\GeneratedValue]
 | 
					 | 
				
			||||||
    #[ORM\Column]
 | 
					 | 
				
			||||||
    private ?int $id = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 200, name: 'denominazione')]
 | 
					 | 
				
			||||||
    private ?string $denomination = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 200, nullable: true, name: 'materia')]
 | 
					 | 
				
			||||||
    private ?string $material = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 100, nullable: true, name: 'rinvenimento')]
 | 
					 | 
				
			||||||
    private ?string $finding = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 100, nullable: true, name: 'misure')]
 | 
					 | 
				
			||||||
    private ?string $measurements = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 200, nullable: true, name: 'datazione')]
 | 
					 | 
				
			||||||
    private ?string $dating = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 255, nullable: true, name: 'stato_conservazione')]
 | 
					 | 
				
			||||||
    private ?string $conservationState = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 255, nullable: true, name: 'luogo_conservazione')]
 | 
					 | 
				
			||||||
    private ?string $conservationPlace = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(type: Types::TEXT, nullable: true, name: 'descrizione')]
 | 
					 | 
				
			||||||
    private ?string $description = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(length: 255, nullable: true, name: 'autore_scheda')]
 | 
					 | 
				
			||||||
    private ?string $author = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(name: 'comune', length: 10, nullable: false)]
 | 
					 | 
				
			||||||
    private ?string $municipality = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    #[ORM\Column(name: 'etichetta', length: 150, nullable: false)]
 | 
					 | 
				
			||||||
    private ?string $label = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private ?float $lat = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private ?float $lng = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * @var Bibliography[] $bibliography
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private ?array $bibliography = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * @var Image[] $images
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private ?array $images = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getId(): ?int
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->id;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setId(string $id): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->id = $id;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getDenomination(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->denomination;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setDenomination(string $denomination): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->denomination = $denomination;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getMaterial(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->material;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setMaterial(?string $material): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->material = $material;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getFinding(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->finding;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setFinding(?string $finding): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->finding = $finding;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getDating(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->dating;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setDating(?string $dating): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->dating = $dating;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getConservationState(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->conservationState;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setConservationState(?string $conservationState): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->conservationState = $conservationState;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getConservationPlace(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->conservationPlace;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setConservationPlace(?string $conservationPlace): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->conservationPlace = $conservationPlace;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getDescription(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->description;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setDescription(?string $description): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->description = $description;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getAuthor(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->author;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setAuthor(string $author): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->author = $author;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getMeasurements(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->measurements;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setMeasurements(?string $measurements): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->measurements = $measurements;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getLabel(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->label;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setLabel(?string $label): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->label = $label;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getMunicipality(): ?string
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->municipality;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setMunicipality(?string $municipality): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->municipality = $municipality;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getLat(): ?float
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->lat;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setLat(float $lat): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->lat = $lat;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getLng(): ?float
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->lng;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setLng(float $lng): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->lng = $lng;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getBibliography(): ?array
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->bibliography;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setBibliography(array $bibliography): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->bibliography = $bibliography;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getImages(): ?array
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->images;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setImages(array $images): static
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->images = $images;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function jsonSerialize(): array
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return [
 | 
					 | 
				
			||||||
            'id' => $this->id,
 | 
					 | 
				
			||||||
            'denomination' => $this->denomination,
 | 
					 | 
				
			||||||
            'material' => $this->material,
 | 
					 | 
				
			||||||
            'measurements' => $this->measurements,
 | 
					 | 
				
			||||||
            'finding' => $this->finding,
 | 
					 | 
				
			||||||
            'dating' => $this->dating,
 | 
					 | 
				
			||||||
            'conservationState' => $this->conservationState,
 | 
					 | 
				
			||||||
            'conservationPlace' => $this->conservationPlace,
 | 
					 | 
				
			||||||
            'description' => $this->description,
 | 
					 | 
				
			||||||
            'author' => $this->author,
 | 
					 | 
				
			||||||
            'label' => $this->label,
 | 
					 | 
				
			||||||
            'municipality' => $this->municipality,
 | 
					 | 
				
			||||||
            'coordinates' => [$this->lat, $this->lng],
 | 
					 | 
				
			||||||
            'bibliography' => $this->bibliography,
 | 
					 | 
				
			||||||
            'images' => $this->images,
 | 
					 | 
				
			||||||
        ];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,59 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace App\Repository;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use App\Entity\Reuse;
 | 
					 | 
				
			||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
 | 
					 | 
				
			||||||
use Doctrine\Persistence\ManagerRegistry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * @extends ServiceEntityRepository<Finding>
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class ReuseRepository extends ServiceEntityRepository
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public function __construct(ManagerRegistry $registry)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        parent::__construct($registry, Reuse::class);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function coordinates(int $id)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $conn = $this->getEntityManager()->getConnection();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $sql = '
 | 
					 | 
				
			||||||
            SELECT
 | 
					 | 
				
			||||||
                ST_X(ST_AsText(coordinate)) as lng,
 | 
					 | 
				
			||||||
                ST_Y(ST_AsText(coordinate)) as lat
 | 
					 | 
				
			||||||
            FROM
 | 
					 | 
				
			||||||
                rinvenimento
 | 
					 | 
				
			||||||
            WHERE id = :id
 | 
					 | 
				
			||||||
        ';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $conn->executeQuery($sql, ['id' => $id])
 | 
					 | 
				
			||||||
            ->fetchAssociative();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    //    /**
 | 
					 | 
				
			||||||
    //     * @return Finding[] Returns an array of Finding objects
 | 
					 | 
				
			||||||
    //     */
 | 
					 | 
				
			||||||
    //    public function findByExampleField($value): array
 | 
					 | 
				
			||||||
    //    {
 | 
					 | 
				
			||||||
    //        return $this->createQueryBuilder('f')
 | 
					 | 
				
			||||||
    //            ->andWhere('f.exampleField = :val')
 | 
					 | 
				
			||||||
    //            ->setParameter('val', $value)
 | 
					 | 
				
			||||||
    //            ->orderBy('f.id', 'ASC')
 | 
					 | 
				
			||||||
    //            ->setMaxResults(10)
 | 
					 | 
				
			||||||
    //            ->getQuery()
 | 
					 | 
				
			||||||
    //            ->getResult()
 | 
					 | 
				
			||||||
    //        ;
 | 
					 | 
				
			||||||
    //    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //    public function findOneBySomeField($value): ?Finding
 | 
					 | 
				
			||||||
    //    {
 | 
					 | 
				
			||||||
    //        return $this->createQueryBuilder('f')
 | 
					 | 
				
			||||||
    //            ->andWhere('f.exampleField = :val')
 | 
					 | 
				
			||||||
    //            ->setParameter('val', $value)
 | 
					 | 
				
			||||||
    //            ->getQuery()
 | 
					 | 
				
			||||||
    //            ->getOneOrNullResult()
 | 
					 | 
				
			||||||
    //        ;
 | 
					 | 
				
			||||||
    //    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user