/
vladislavts
/
gcppmsp
Обзор
Документация
Войти
/
vladislavts
/
gcppmsp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
prod
src/Repository/VisitorRepository.php
74 строки
2 KB
Vladislav
Работает createvisitor
03 сен 2023, 10:22
03 сен 2023, 10:22
e9bfc49
Код
Авторство
О чём код?
<?php namespace App\Repository; use App\Entity\Visitor; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; use Doctrine\Persistence\ManagerRegistry; /** * @method Visitor|null find($id, $lockMode = null, $lockVersion = null) * @method Visitor|null findOneBy(array $criteria, array $orderBy = null) * @method Visitor[] findAll() * @method Visitor[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class VisitorRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Visitor::class); } /** * @throws ORMException * @throws OptimisticLockException */ public function add(Visitor $entity, bool $flush = true): void { $this->_em->persist($entity); if ($flush) { $this->_em->flush(); } } /** * @throws ORMException * @throws OptimisticLockException */ public function remove(Visitor $entity, bool $flush = true): void { $this->_em->remove($entity); if ($flush) { $this->_em->flush(); } } // /** // * @return Visitor[] Returns an array of Visitor objects // */ /* public function findByExampleField($value) { return $this->createQueryBuilder('v') ->andWhere('v.exampleField = :val') ->setParameter('val', $value) ->orderBy('v.id', 'ASC') ->setMaxResults(10) ->getQuery() ->getResult() ; } */ public function findOneByCard($value): ?Visitor { return $this->createQueryBuilder('v') ->andWhere('v.card = :val') ->setParameter('val', $value) ->getQuery() ->getOneOrNullResult() ; } }