-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStepRepository.php
More file actions
79 lines (68 loc) · 2.09 KB
/
StepRepository.php
File metadata and controls
79 lines (68 loc) · 2.09 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
75
76
77
78
79
<?php
namespace App\Repository;
use App\Entity\Step;
use App\Repository\Interface\Searchable;
use App\Repository\Trait\Search;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Step>
*
* @method Step|null find( $id, $lockMode = null, $lockVersion = null )
* @method Step|null findOneBy( array $criteria, array $orderBy = null )
* @method Step[] findAll()
* @method Step[] findBy( array $criteria, array $orderBy = null, $limit = null, $offset = null )
*/
class StepRepository extends ServiceEntityRepository implements Searchable
{
use Search;
public function __construct( ManagerRegistry $registry )
{
parent::__construct( $registry, Step::class );
}
public function save( Step $entity, bool $flush = false ): void
{
$this->getEntityManager()->persist( $entity );
if ( $flush ) {
$this->getEntityManager()->flush();
}
}
public function remove( Step $entity, bool $flush = false ): void
{
$this->getEntityManager()->remove( $entity );
if ( $flush ) {
$this->getEntityManager()->flush();
}
}
public function findOneByRef( $value ): ?Step
{
return $this->createQueryBuilder( 'd' )
->andWhere( 'd.ref = :val' )
->setParameter( 'val', $value )
->getQuery()
->getOneOrNullResult();
}
// /**
// * @return Step[] Returns an array of Step objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Step
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}