Add Prehistoric stuff...
This commit is contained in:
59
src/Repository/PrehistoricRepository.php
Normal file
59
src/Repository/PrehistoricRepository.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Prehistoric;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Prehistoric>
|
||||
*/
|
||||
class PrehistoricRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Prehistoric::class);
|
||||
}
|
||||
|
||||
public function coordinates(int $id): array|bool
|
||||
{
|
||||
$conn = $this->getEntityManager()->getConnection();
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
ST_X(ST_AsText(coordinate)) as lng,
|
||||
ST_Y(ST_AsText(coordinate)) as lat
|
||||
FROM
|
||||
preistoria
|
||||
WHERE id = :id
|
||||
';
|
||||
|
||||
return $conn->executeQuery($sql, ['id' => $id])
|
||||
->fetchAssociative();
|
||||
}
|
||||
// /**
|
||||
// * @return Prehistoric[] Returns an array of Prehistoric objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('p.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Prehistoric
|
||||
// {
|
||||
// return $this->createQueryBuilder('p')
|
||||
// ->andWhere('p.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user