| 1 | <?php |
||
| 10 | abstract class AbstractRepository extends EntityRepository |
||
| 11 | { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @return \Doctrine\ORM\EntityManager |
||
| 15 | */ |
||
| 16 | public function getEntityManager() |
||
| 20 | |||
| 21 | 11 | public function flush($entity = null) |
|
| 22 | { |
||
| 23 | 11 | $this->_em->flush($entity); |
|
| 24 | 11 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @param object $entity |
||
| 28 | */ |
||
| 29 | 9 | public function persist($entity) |
|
| 33 | |||
| 34 | /** |
||
| 35 | * @param object $entity |
||
| 36 | */ |
||
| 37 | 1 | public function remove($entity) |
|
| 38 | { |
||
| 39 | 1 | $this->_em->remove($entity); |
|
| 40 | 1 | } |
|
| 41 | |||
| 42 | /** |
||
| 43 | * @param int|string|array $id |
||
| 44 | * @return object|null Entity |
||
| 45 | */ |
||
| 46 | 28 | public function findOneById($id) |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @param int $limit |
||
| 53 | * @param int $offset |
||
| 54 | * @return object[] Entity array |
||
| 55 | */ |
||
| 56 | 4 | public function findAllWithLimitAndOffset(int $limit = 50, int $offset = null): array |
|
| 69 | |||
| 70 | 4 | public function countAll(): int |
|
| 78 | |||
| 79 | 4 | private function getEntityIdField(): string |
|
| 86 | } |
||
| 87 |