1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Silverback\ApiComponentBundle\Repository\Component; |
6
|
|
|
|
7
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
8
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
9
|
|
|
use Doctrine\Common\Collections\Collection; |
10
|
|
|
use Silverback\ApiComponentBundle\Entity\Component\ComponentLocation; |
11
|
|
|
use Symfony\Bridge\Doctrine\RegistryInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @method ComponentLocation|null find($id, $lockMode = null, $lockVersion = null) |
15
|
|
|
* @method ComponentLocation|null findOneBy(array $criteria, array $orderBy = null) |
16
|
|
|
* @method ComponentLocation[] findAll() |
17
|
|
|
* @method ComponentLocation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
18
|
|
|
*/ |
19
|
|
|
class ComponentLocationRepository extends ServiceEntityRepository |
20
|
|
|
{ |
21
|
|
|
public function __construct(RegistryInterface $registry) |
22
|
|
|
{ |
23
|
|
|
parent::__construct($registry, ComponentLocation::class); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function findByDynamicPage(string $dynamicPageClass): Collection |
27
|
|
|
{ |
28
|
|
|
$qb = $this->createQueryBuilder('location'); |
29
|
|
|
$qb |
30
|
|
|
->andWhere( |
31
|
|
|
$qb->expr()->eq('location.dynamicPageClass', ':cls') |
32
|
|
|
) |
33
|
|
|
->setParameter('cls', $dynamicPageClass) |
34
|
|
|
->addOrderBy('location.sort', 'ASC'); |
35
|
|
|
|
36
|
|
|
$result = new ArrayCollection($qb->getQuery()->getResult()); |
37
|
|
|
|
38
|
|
|
$uow = $this->getEntityManager()->getUnitOfWork(); |
39
|
|
|
$scheduledInsertions = $uow->getScheduledEntityInsertions(); |
40
|
|
|
foreach ($scheduledInsertions as $scheduledInsertion) { |
41
|
|
|
if ($scheduledInsertion instanceof ComponentLocation && $scheduledInsertion->getDynamicPageClass() === $dynamicPageClass) { |
|
|
|
|
42
|
|
|
$result->add($scheduledInsertion); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
return $result; |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.