1 | <?php |
||
26 | final class DoctrineORMFileRepository extends EntityRepository implements FileRepository |
||
27 | { |
||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | public function fileOfId(FileId $anId) |
||
32 | { |
||
33 | return $this->find($anId->id()); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function query($aSpecification) |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function singleResultQuery($aSpecification) |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function length($aSpecification) |
||
58 | { |
||
59 | if (null === $aSpecification) { |
||
60 | $queryBuilder = $this->getEntityManager()->createQueryBuilder(); |
||
61 | |||
62 | return (int) $queryBuilder |
||
63 | ->select($queryBuilder->expr()->count('f.id')) |
||
64 | ->getQuery() |
||
65 | ->getSingleScalarResult(); |
||
66 | } |
||
67 | |||
68 | return (int) $aSpecification->buildCount( |
||
69 | $this->createQueryBuilder('f') |
||
70 | )->getSingleScalarResult(); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function persist(File $aFile) |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function remove(File $aFile) |
||
88 | } |
||
89 |