Code Duplication    Length = 7-8 lines in 2 locations

Bundle/BusinessPageBundle/Builder/BusinessPageReferenceBuilder.php 1 location

@@ 31-37 (lines=7) @@
28
        $entity = $businessPage->getEntityProxy()->getEntity();
29
        $accessor = new PropertyAccessor();
30
        $entityId = null;
31
        if ($entity) {
32
            if (method_exists($entity, 'getId')) {
33
                $entityId = $entity->getId();
34
            } else {
35
                $entityId = $accessor->getValue($entity, $businessEntity->getBusinessIdentifiers()->first()->getName());
36
            }
37
        }
38
        $referenceId = ViewReferenceHelper::generateViewReferenceId($businessPage);
39
        $businessPageReference = new BusinessPageReference();
40
        $businessPageReference->setId($referenceId);

Bundle/BusinessPageBundle/Repository/BusinessPageRepository.php 1 location

@@ 26-33 (lines=8) @@
23
     */
24
    public function findPageByBusinessEntityAndPattern(BusinessTemplate $pattern, $entity, BusinessEntity $businessEntity)
25
    {
26
        if (is_object($entity)) {
27
            $accessor = new PropertyAccessor();
28
            if (method_exists($entity, 'getId')) {
29
                $entityId = $entity->getId();
30
            } else {
31
                $entityId = $accessor->getValue($entity, $businessEntity->getBusinessIdentifiers()->first()->getName());
32
            }
33
        }
34
        $qb = $this->createQueryBuilder('BusinessPage');
35
        $qb->join('BusinessPage.entityProxy', 'proxy');
36
        $qb->join('BusinessPage.template', 'template');