Code Duplication    Length = 9-9 lines in 2 locations

Bundle/PageBundle/Helper/PageHelper.php 1 location

@@ 270-278 (lines=9) @@
267
        if ($viewReference instanceof BusinessPageReference && !empty($viewReference->getEntityId())) {
268
            $businessEntity = $this->entityManager->getRepository('VictoireBusinessEntityBundle:BusinessEntity')
269
                ->findOneBy(['id' => $viewReference->getBusinessEntity()]);
270
            if ($businessEntity->getType() === ORMBusinessEntity::TYPE) {
271
                $entity = $this->entityManager->getRepository($businessEntity->getClass())
272
                    ->findOneBy(['id' => $viewReference->getEntityId()]);
273
            } else {
274
                $entityProxy = new EntityProxy();
275
                $entityProxy->setBusinessEntity($businessEntity);
276
                $entityProxy->setRessourceId($viewReference->getEntityId());
277
                $entity = $this->apiBusinessEntityResolver->getBusinessEntity($entityProxy);
278
            }
279
        }
280
281
        return $entity;

Bundle/PageBundle/EventSubscriber/PageSubscriber.php 1 location

@@ 159-167 (lines=9) @@
156
                $entityProxy = $view->getEntityProxy();
157
                $viewReference = $view->getReference();
158
159
                if ($businessEntity->getType() === ORMBusinessEntity::TYPE) {
160
                    $entity = $eventArgs->getEntityManager()->getRepository($businessEntity->getClass())
161
                        ->findOneBy(['id' => $viewReference->getEntityId()]);
162
                } else {
163
                    $entityProxy = new EntityProxy();
164
                    $entityProxy->setBusinessEntity($businessEntity);
165
                    $entityProxy->setRessourceId($viewReference->getEntityId());
166
                    $entity = $this->apiBusinessEntityResolver->getBusinessEntity($entityProxy);
167
                }
168
169
                $entityProxy->setEntity($entity);
170
                $view->setEntityProxy($entityProxy);