2024-07-10 23:30:59 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Repository;
|
|
|
|
|
|
|
|
|
|
use App\Entity\Entity;
|
|
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
2024-12-20 19:41:48 +01:00
|
|
|
use Doctrine\DBAL\Exception;
|
2024-07-10 23:30:59 +02:00
|
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @extends ServiceEntityRepository<Entity>
|
|
|
|
|
*/
|
|
|
|
|
class EntityRepository extends ServiceEntityRepository
|
|
|
|
|
{
|
|
|
|
|
public function __construct(ManagerRegistry $registry)
|
|
|
|
|
{
|
|
|
|
|
parent::__construct($registry, Entity::class);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 19:41:48 +01:00
|
|
|
/**
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public function findByjCard(array $vCardArray): array
|
|
|
|
|
{
|
|
|
|
|
return $this->getEntityManager()->getConnection()
|
2024-12-20 21:29:29 +01:00
|
|
|
->prepare('SELECT * FROM entity WHERE j_Card @> :data AND j_Card <@ :data')
|
2024-12-20 19:41:48 +01:00
|
|
|
->executeQuery(['data' => json_encode($vCardArray)])
|
|
|
|
|
->fetchAllAssociative();
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-10 23:30:59 +02:00
|
|
|
// /**
|
|
|
|
|
// * @return Entity[] Returns an array of Entity objects
|
|
|
|
|
// */
|
|
|
|
|
// public function findByExampleField($value): array
|
|
|
|
|
// {
|
|
|
|
|
// return $this->createQueryBuilder('e')
|
|
|
|
|
// ->andWhere('e.exampleField = :val')
|
|
|
|
|
// ->setParameter('val', $value)
|
|
|
|
|
// ->orderBy('e.id', 'ASC')
|
|
|
|
|
// ->setMaxResults(10)
|
|
|
|
|
// ->getQuery()
|
|
|
|
|
// ->getResult()
|
|
|
|
|
// ;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// public function findOneBySomeField($value): ?Entity
|
|
|
|
|
// {
|
|
|
|
|
// return $this->createQueryBuilder('e')
|
|
|
|
|
// ->andWhere('e.exampleField = :val')
|
|
|
|
|
// ->setParameter('val', $value)
|
|
|
|
|
// ->getQuery()
|
|
|
|
|
// ->getOneOrNullResult()
|
|
|
|
|
// ;
|
|
|
|
|
// }
|
|
|
|
|
}
|