| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 28% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class ServiceAttributeRepository implements ServiceAttributeRepositoryInterface { |
||
| 9 | |||
| 10 | private $em; |
||
| 11 | |||
| 12 | 9 | public function __construct(EntityManagerInterface $objectManager) { |
|
| 13 | 9 | $this->em = $objectManager; |
|
| 14 | 9 | } |
|
| 15 | |||
| 16 | /** |
||
| 17 | * @inheritDoc |
||
| 18 | */ |
||
| 19 | public function getAttributes() { |
||
| 20 | return $this->findAll(); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getAttributesForServiceProvider($entityId) { |
||
| 24 | $queryBuilder = $this->em |
||
| 25 | ->createQueryBuilder() |
||
| 26 | ->select(['a', 's']) |
||
| 27 | ->from(ServiceAttribute::class, 'a') |
||
| 28 | ->leftJoin('a.services', 's') |
||
| 29 | ->where('s.entityId = :entityId') |
||
| 30 | ->setParameter('entityId', $entityId); |
||
| 31 | |||
| 32 | return $queryBuilder->getQuery()->getResult(); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @inheritDoc |
||
| 37 | */ |
||
| 38 | 1 | public function findAll() { |
|
| 39 | 1 | return $this->em |
|
| 40 | 1 | ->getRepository(ServiceAttribute::class) |
|
| 41 | 1 | ->findAll(); |
|
| 42 | } |
||
| 43 | |||
| 44 | public function persist(ServiceAttribute $attribute) { |
||
| 47 | } |
||
| 48 | |||
| 49 | public function remove(ServiceAttribute $attribute) { |
||
| 52 | } |
||
| 53 | } |