Repository navigation
Expand file tree
/
Copy pathApiTokenRepository.php
More file actions
74 lines (67 loc) · 2.01 KB
/
Copy pathApiTokenRepository.php
File metadata and controls
74 lines (67 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace SyncEngine\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Doctrine\Persistence\ManagerRegistry;
use SyncEngine\Entity\ApiToken;
/**
* @extends ServiceEntityRepository<ApiToken>
*
* @method ApiToken|null find( $id, $lockMode = null, $lockVersion = null )
* @method ApiToken|null findOneBy( array $criteria, array $orderBy = null )
* @method ApiToken[] findAll()
* @method ApiToken[] findBy( array $criteria, array $orderBy = null, $limit = null, $offset = null )
*/
class ApiTokenRepository extends ServiceEntityRepository
{
public function __construct( ManagerRegistry $registry )
{
parent::__construct( $registry, ApiToken::class );
}
/**
* @throws ORMException
* @throws OptimisticLockException
*/
public function add( ApiToken $entity, bool $flush = true ): void
{
$this->getEntityManager()->persist( $entity );
if ( $flush ) {
$this->getEntityManager()->flush();
}
}
/**
* @throws ORMException
* @throws OptimisticLockException
*/
public function remove( ApiToken $entity, bool $flush = true ): void
{
$this->getEntityManager()->remove( $entity );
if ( $flush ) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return ApiToken[] Returns an array of ApiToken objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('a.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?ApiToken
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}