Code Duplication    Length = 9-9 lines in 2 locations

Bundle/PageBundle/EventSubscriber/PageSubscriber.php 1 location

@@ 166-174 (lines=9) @@
163
                $entityProxy = $view->getEntityProxy();
164
                $viewReference = $view->getReference();
165
166
                if ($businessEntity->getType() === ORMBusinessEntity::TYPE) {
167
                    $entity = $eventArgs->getEntityManager()->getRepository($businessEntity->getClass())
168
                        ->findOneBy(['id' => $viewReference->getEntityId()]);
169
                } else {
170
                    $entityProxy = new EntityProxy();
171
                    $entityProxy->setBusinessEntity($businessEntity);
172
                    $entityProxy->setRessourceId($viewReference->getEntityId());
173
                    $entity = $this->apiBusinessEntityResolver->getBusinessEntity($entityProxy);
174
                }
175
176
                $entityProxy->setEntity($entity);
177
                $view->setEntityProxy($entityProxy);

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;