예제 #1
0
 /**
  * Process form
  *
  * @param  CalendarEvent $entity
  * @throws \LogicException
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(CalendarEvent $entity)
 {
     if (!$entity->getCalendar()) {
         if ($this->securityFacade->getLoggedUser() && $this->securityFacade->getOrganization()) {
             /** @var Calendar $defaultCalendar */
             $defaultCalendar = $this->manager->getRepository('OroCalendarBundle:Calendar')->findDefaultCalendar($this->securityFacade->getLoggedUser()->getId(), $this->securityFacade->getOrganization()->getId());
             $entity->setCalendar($defaultCalendar);
         } else {
             throw new \LogicException('Current user did not define');
         }
     }
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
             if ($targetEntityClass) {
                 $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
                 $targetEntity = $this->entityRoutingHelper->getEntityReference($targetEntityClass, $targetEntityId);
                 $action = $this->entityRoutingHelper->getAction($this->request);
                 if ($action === 'activity') {
                     $this->activityManager->addActivityTarget($entity, $targetEntity);
                 }
                 if ($action === 'assign' && $targetEntity instanceof User && $targetEntityId !== $this->securityFacade->getLoggedUserId()) {
                     /** @var Calendar $defaultCalendar */
                     $defaultCalendar = $this->manager->getRepository('OroCalendarBundle:Calendar')->findDefaultCalendar($targetEntity->getId(), $targetEntity->getOrganization()->getId());
                     $entity->setCalendar($defaultCalendar);
                 }
             }
             $this->onSuccess($entity);
             return true;
         }
     }
     return false;
 }
예제 #2
0
 /**
  * @param object      $object
  * @param string|null $action
  *
  * @return array
  */
 public function getActionParams($object, $action = null)
 {
     if (!is_object($object)) {
         return [];
     }
     return $this->entityRoutingHelper->getRouteParameters($this->getClassName($object, true), $this->entityIdAccessor->getIdentifier($object), $action);
 }
예제 #3
0
 /**
  * Process form
  *
  * @param  Call $entity
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(Call $entity)
 {
     $targetEntityClass = $this->request->get('entityClass');
     $targetEntityId = $this->request->get('entityId');
     $options = [];
     if ($targetEntityClass && $this->request->getMethod() === 'GET') {
         $targetEntity = $this->entityRoutingHelper->getEntity($targetEntityClass, $targetEntityId);
         if (!$entity->getId()) {
             $entity->setPhoneNumber($this->phoneProvider->getPhoneNumber($targetEntity));
         }
         $options = ['phone_suggestions' => array_unique(array_map(function ($item) {
             return $item[0];
         }, $this->phoneProvider->getPhoneNumbers($targetEntity)))];
     }
     $this->form = $this->formFactory->createNamed($this->formName, $this->formType, $entity, $options);
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             if ($targetEntityClass) {
                 $targetEntity = $this->entityRoutingHelper->getEntity($targetEntityClass, $targetEntityId);
                 $this->callActivityManager->addAssociation($entity, $targetEntity);
                 $phones = $this->phoneProvider->getPhoneNumbers($targetEntity);
                 foreach ($phones as $phone) {
                     if ($entity->getPhoneNumber() === $phone[0]) {
                         $this->callActivityManager->addAssociation($entity, $phone[1]);
                     }
                 }
             }
             $this->onSuccess($entity);
             return true;
         }
     }
     return false;
 }
 /**
  * Process form
  *
  * @param  Issue $entity
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(Issue $entity)
 {
     $action = $this->entityRoutingHelper->getAction($this->request);
     $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
     $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
     if ($targetEntityClass && !$entity->getId() && $this->request->getMethod() === 'GET' && $action === 'assign' && is_a($targetEntityClass, 'Oro\\Bundle\\UserBundle\\Entity\\User', true)) {
         $entity->setAssignee($this->entityRoutingHelper->getEntity($targetEntityClass, $targetEntityId));
         FormUtils::replaceField($this->form, 'assignee', ['read_only' => true]);
     }
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             /* if ($targetEntityClass && $action === 'activity') {
                    $this->activityManager->addActivityTarget(
                        $entity,
                        $this->entityRoutingHelper->getEntityReference($targetEntityClass, $targetEntityId)
                    );
                }*/
             $this->onSuccess($entity);
             return true;
         }
     }
     return false;
 }
예제 #5
0
 /**
  * Process form
  *
  * @param  CalendarEvent $entity
  *
  * @throws \LogicException
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(CalendarEvent $entity)
 {
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $originalChildren = new ArrayCollection();
         foreach ($entity->getChildEvents() as $childEvent) {
             $originalChildren->add($childEvent);
         }
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $this->ensureCalendarSet($entity);
             $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
             if ($targetEntityClass) {
                 $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
                 $targetEntity = $this->entityRoutingHelper->getEntityReference($targetEntityClass, $targetEntityId);
                 $action = $this->entityRoutingHelper->getAction($this->request);
                 if ($action === 'activity') {
                     $this->activityManager->addActivityTarget($entity, $targetEntity);
                 }
                 if ($action === 'assign' && $targetEntity instanceof User && $targetEntityId !== $this->securityFacade->getLoggedUserId()) {
                     /** @var Calendar $defaultCalendar */
                     $defaultCalendar = $this->manager->getRepository('OroCalendarBundle:Calendar')->findDefaultCalendar($targetEntity->getId(), $targetEntity->getOrganization()->getId());
                     $entity->setCalendar($defaultCalendar);
                 }
             }
             $this->onSuccess($entity, $originalChildren, $this->form->get('notifyInvitedUsers')->getData());
             return true;
         }
     }
     return false;
 }
예제 #6
0
 /**
  * Gets definition for tag column.
  *
  * @param DatagridConfiguration $config
  *
  * @return array
  */
 protected function getColumnDefinition(DatagridConfiguration $config)
 {
     $className = $this->getEntityClassName($config);
     $urlSafeClassName = $this->entityRoutingHelper->getUrlSafeClassName($className);
     $permissions = ['oro_tag_create' => $this->securityFacade->isGranted(TagManager::ACL_RESOURCE_CREATE_ID_KEY), 'oro_tag_unassign_global' => $this->securityFacade->isGranted(TagManager::ACL_RESOURCE_REMOVE_ID_KEY)];
     return ['label' => 'oro.tag.tags_label', 'type' => 'callback', 'frontend_type' => 'tags', 'callable' => function (ResultRecordInterface $record) {
         return $record->getValue(self::COLUMN_NAME);
     }, 'editable' => false, 'translatable' => true, 'renderable' => $this->taggableHelper->isEnableGridColumn($className), 'inline_editing' => ['enable' => $this->securityFacade->isGranted(TagManager::ACL_RESOURCE_ASSIGN_ID_KEY), 'editor' => ['view' => 'orotag/js/app/views/editor/tags-editor-view', 'view_options' => ['permissions' => $permissions]], 'save_api_accessor' => ['route' => 'oro_api_post_taggable', 'http_method' => 'POST', 'default_route_parameters' => ['entity' => $urlSafeClassName], 'route_parameters_rename_map' => ['id' => 'entityId']], 'autocomplete_api_accessor' => ['class' => 'oroui/js/tools/search-api-accessor', 'search_handler_name' => 'tags', 'label_field_name' => 'name']]];
 }
예제 #7
0
 /**
  * @param string $className
  * @param int    $id
  *
  * @return object
  *
  * @throws \Exception
  */
 protected function getEntity($className, $id)
 {
     try {
         $entity = $this->entityRoutingHelper->getEntity($className, $id);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage(), Codes::HTTP_NOT_FOUND);
     }
     return $entity;
 }
 /**
  * Get target entity to associate with the github issue
  *
  * @return null|object
  */
 protected function getTargetEntity()
 {
     $targetEntity = null;
     $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
     if ($targetEntityClass) {
         $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
         $targetEntity = $this->entityRoutingHelper->getEntityReference($targetEntityClass, $targetEntityId);
     }
     return $targetEntity;
 }
예제 #9
0
 /**
  * @param BuildAfter $event
  */
 public function onBuildAfter(BuildAfter $event)
 {
     $datagrid = $event->getDatagrid();
     $datasource = $datagrid->getDatasource();
     if ($datasource instanceof OrmDatasource) {
         $parameters = $datagrid->getParameters();
         $entityClass = $this->entityRoutingHelper->resolveEntityClass($parameters->get('entityClass'));
         $entityId = $parameters->get('entityId');
         // apply activity filter
         $this->activityManager->addFilterByTargetEntity($datasource->getQueryBuilder(), $entityClass, $entityId);
     }
 }
예제 #10
0
 /**
  * @param string $entityClass
  * @return string|null
  */
 public function getContextGridByEntity($entityClass)
 {
     if (!empty($entityClass)) {
         $entityClass = $this->routingHelper->resolveEntityClass($entityClass);
         $config = $this->entityConfigProvider->getConfig($entityClass);
         $gridName = $config->get('context-grid');
         if ($gridName) {
             return $gridName;
         }
     }
     return null;
 }
예제 #11
0
 /**
  * @param string $className
  * @param int    $id
  * @param array  $data
  *
  * @return array
  *
  * @throws AccessDeniedException
  */
 public function patch($className, $id, $data)
 {
     $entity = $this->entityRoutingHelper->getEntity($className, $id);
     if (!$this->securityService->isGranted('EDIT', $entity)) {
         throw new AccessDeniedException();
     }
     try {
         return $this->entityDataManager->update($entity, $data);
     } catch (FieldUpdateAccessException $e) {
         throw new AccessDeniedException($e->getMessage(), $e);
     }
 }
 /**
  * @param BuildAfter $event
  */
 public function onBuildAfter(BuildAfter $event)
 {
     $datagrid = $event->getDatagrid();
     $datasource = $datagrid->getDatasource();
     if ($datasource instanceof OrmDatasource) {
         $parameters = $datagrid->getParameters();
         $entityClass = $this->entityRoutingHelper->decodeClassName($parameters->get('entityClass'));
         $entityId = $parameters->get('entityId');
         $this->emailGridHelper->updateDatasource($datasource, $entityId, $entityClass);
         if ($this->emailGridHelper->isUserEntity($entityClass)) {
             $this->emailGridHelper->handleRefresh($parameters, $entityId);
         }
     }
 }
예제 #13
0
 /**
  * @param string      $emailAddress
  * @param string|null $ownerClass
  * @param mixed|null  $ownerId
  */
 protected function preciseFullEmailAddress(&$emailAddress, $ownerClass = null, $ownerId = null)
 {
     if (!$this->emailAddressHelper->isFullEmailAddress($emailAddress)) {
         if (!empty($ownerClass) && !empty($ownerId)) {
             $owner = $this->entityRoutingHelper->getEntity($ownerClass, $ownerId);
             if ($owner) {
                 $ownerName = $this->nameFormatter->format($owner);
                 if (!empty($ownerName)) {
                     $emailAddress = $this->emailAddressHelper->buildFullEmailAddress($emailAddress, $ownerName);
                     return;
                 }
             }
         }
         $repo = $this->emailAddressManager->getEmailAddressRepository($this->em);
         $emailAddressObj = $repo->findOneBy(array('email' => $emailAddress));
         if ($emailAddressObj) {
             $owner = $emailAddressObj->getOwner();
             if ($owner) {
                 $ownerName = $this->nameFormatter->format($owner);
                 if (!empty($ownerName)) {
                     $emailAddress = $this->emailAddressHelper->buildFullEmailAddress($emailAddress, $ownerName);
                 }
             }
         }
     }
 }
 public function testDecodeClassName()
 {
     $className = 'Class';
     $this->entityRoutingHelper->expects($this->once())->method('resolveEntityClass')->with($className)->willReturn($className);
     $result = $this->helper->decodeClassName($className);
     $this->assertEquals($result, $className);
 }
예제 #15
0
 /**
  * @param string $entityClass
  *
  * @return string|null
  */
 public function getContextGridByEntity($entityClass)
 {
     if (!empty($entityClass)) {
         $entityClass = $this->routingHelper->resolveEntityClass($entityClass);
         if (ExtendHelper::isCustomEntity($entityClass)) {
             return 'custom-entity-grid';
         }
         $config = $this->entityConfigProvider->getConfig($entityClass);
         if ($config->has('context')) {
             return $config->get('context');
         }
         if ($config->has('default')) {
             return $config->get('default');
         }
     }
     return null;
 }
예제 #16
0
 /**
  * Adds default or existent activity contexts data to the form
  *
  * @param FormEvent $event
  */
 public function addDefaultContextListener(FormEvent $event)
 {
     /** @var ActivityInterface $entity */
     $entity = $event->getData();
     $form = $event->getForm();
     if ($entity) {
         $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
         $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
         $contexts = [];
         if ($entity->getId()) {
             $contexts = $entity->getActivityTargetEntities();
         } elseif ($targetEntityClass && $this->request->getMethod() === 'GET') {
             $contexts[] = $this->entityRoutingHelper->getEntity($targetEntityClass, $targetEntityId);
         }
         $form->get('contexts')->setData($contexts);
     }
 }
예제 #17
0
 /**
  * @param BuildAfter $event
  */
 public function onBuildAfter(BuildAfter $event)
 {
     $datagrid = $event->getDatagrid();
     $datasource = $datagrid->getDatasource();
     if ($datasource instanceof OrmDatasource) {
         $parameters = $datagrid->getParameters();
         $entityClass = $this->entityRoutingHelper->decodeClassName($parameters->get('entityClass'));
         $entityId = $parameters->get('entityId');
         $qb = $datasource->getQueryBuilder();
         // apply activity filter
         $this->activityManager->addFilterByTargetEntity($qb, $entityClass, $entityId);
         // apply filter by date
         $start = new \DateTime('now', new \DateTimeZone($this->localeSettings->getTimeZone()));
         $start->setTime(0, 0, 0);
         $qb->andWhere('event.start >= :date OR event.end >= :date')->setParameter('date', $start);
     }
 }
예제 #18
0
 /**
  * Process form
  *
  * @param  Call $entity
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(Call $entity)
 {
     $targetEntityClass = $this->request->get('entityClass');
     $targetEntityId = $this->request->get('entityId');
     $options = [];
     if ($targetEntityClass && $this->request->getMethod() === 'GET') {
         $targetEntity = $this->entityRoutingHelper->getEntity($targetEntityClass, $targetEntityId);
         if (!$entity->getId()) {
             $phone = $this->request->query->get('phone');
             if (!$phone) {
                 $phone = $this->phoneProvider->getPhoneNumber($targetEntity);
             }
             $entity->setPhoneNumber($phone);
         }
         $options = ['phone_suggestions' => array_unique(array_map(function ($item) {
             return $item[0];
         }, $this->phoneProvider->getPhoneNumbers($targetEntity)))];
     }
     $this->form = $this->formFactory->createNamed($this->formName, $this->formType, $entity, $options);
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             // TODO: should be refactored after finishing BAP-8722
             // Contexts handling should be moved to common for activities form handler
             if ($this->form->has('contexts')) {
                 $contexts = $this->form->get('contexts')->getData();
                 $this->activityManager->setActivityTargets($entity, $contexts);
             } elseif ($targetEntityClass) {
                 // if we don't have "contexts" form field
                 // we should save association between activity and target manually
                 $targetEntity = $this->entityRoutingHelper->getEntity($targetEntityClass, $targetEntityId);
                 $this->callActivityManager->addAssociation($entity, $targetEntity);
                 $phones = $this->phoneProvider->getPhoneNumbers($targetEntity);
                 foreach ($phones as $phone) {
                     if ($entity->getPhoneNumber() === $phone[0]) {
                         $this->callActivityManager->addAssociation($entity, $phone[1]);
                     }
                 }
             }
             $this->onSuccess($entity);
             return true;
         }
     }
     return false;
 }
예제 #19
0
 /**
  * {@inheritdoc}
  */
 public function getWidgets($object)
 {
     $result = [];
     $entityClass = ClassUtils::getClass($object);
     $entityId = $this->entityIdAccessor->getIdentifier($object);
     $items = $this->activityManager->getActivityAssociations($entityClass);
     foreach ($items as $item) {
         if (empty($item['acl']) || $this->securityFacade->isGranted($item['acl'])) {
             $url = $this->entityRoutingHelper->generateUrl($item['route'], $entityClass, $entityId);
             $alias = sprintf('%s_%s_%s', strtolower(ExtendHelper::getShortClassName($item['className'])), dechex(crc32($item['className'])), $item['associationName']);
             $widget = ['widgetType' => 'block', 'alias' => $alias, 'label' => $this->translator->trans($item['label']), 'url' => $url];
             if (isset($item['priority'])) {
                 $widget['priority'] = $item['priority'];
             }
             $result[] = $widget;
         }
     }
     return $result;
 }
예제 #20
0
 /**
  * Process form
  *
  * @param  Task $entity
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(Task $entity)
 {
     $action = $this->entityRoutingHelper->getAction($this->request);
     $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
     $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
     if ($targetEntityClass && !$entity->getId() && $this->request->getMethod() === 'GET' && $action === 'assign' && is_a($targetEntityClass, 'Oro\\Bundle\\UserBundle\\Entity\\User', true)) {
         $entity->setOwner($this->entityRoutingHelper->getEntity($targetEntityClass, $targetEntityId));
         FormUtils::replaceField($this->form, 'owner', ['read_only' => true]);
     }
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             // TODO: should be refactored after finishing BAP-8722
             // Contexts handling should be moved to common for activities form handler
             if ($this->form->has('contexts')) {
                 $contexts = $this->form->get('contexts')->getData();
                 $this->activityManager->setActivityTargets($entity, $contexts);
             } elseif ($targetEntityClass && $action === 'activity') {
                 // if we don't have "contexts" form field
                 // we should save association between activity and target manually
                 $this->activityManager->addActivityTarget($entity, $this->entityRoutingHelper->getEntityReference($targetEntityClass, $targetEntityId));
             }
             $this->onSuccess($entity);
             return true;
         }
     }
     return false;
 }
예제 #21
0
 /**
  * @dataProvider supportedMethods
  *
  * @param string $method
  */
 public function testProcessValidDataWithTargetEntityActivity($method)
 {
     $targetEntity = new TestTarget(123);
     $action = 'activity';
     $this->request->setMethod($method);
     $this->form->expects($this->once())->method('setData')->with($this->identicalTo($this->entity));
     $this->form->expects($this->once())->method('submit')->with($this->identicalTo($this->request));
     $this->form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->entityRoutingHelper->expects($this->once())->method('getAction')->with($this->identicalTo($this->request))->will($this->returnValue($action));
     $this->entityRoutingHelper->expects($this->once())->method('getEntityClassName')->with($this->identicalTo($this->request))->will($this->returnValue(get_class($targetEntity)));
     $this->entityRoutingHelper->expects($this->once())->method('getEntityId')->with($this->identicalTo($this->request))->will($this->returnValue($targetEntity->getId()));
     $this->entityRoutingHelper->expects($this->once())->method('getEntityReference')->with(get_class($targetEntity), $targetEntity->getId())->will($this->returnValue($targetEntity));
     $this->activityManager->expects($this->once())->method('addActivityTarget')->with($this->identicalTo($this->entity), $this->identicalTo($targetEntity));
     $this->om->expects($this->once())->method('persist')->with($this->identicalTo($this->entity));
     $this->om->expects($this->once())->method('flush');
     $this->assertTrue($this->handler->process($this->entity));
 }
예제 #22
0
 /**
  * @param Config $config
  *
  * @return array
  */
 public function getActivityListOption(Config $config)
 {
     $entityConfigProvider = $this->configManager->getProvider('entity');
     $templates = [];
     foreach ($this->providers as $provider) {
         $hasComment = false;
         if ($provider instanceof CommentProviderInterface) {
             $hasComment = $provider->hasComments($this->configManager, $provider->getActivityClass());
         }
         $template = $provider->getTemplate();
         if ($provider instanceof ActivityListGroupProviderInterface && $config->get('oro_activity_list.grouping')) {
             $template = $provider->getGroupedTemplate();
         }
         $entityConfig = $entityConfigProvider->getConfig($provider->getActivityClass());
         $templates[$this->routingHelper->getUrlSafeClassName($provider->getActivityClass())] = ['icon' => $entityConfig->get('icon'), 'label' => $this->translator->trans($entityConfig->get('label')), 'template' => $template, 'routes' => $provider->getRoutes(), 'has_comments' => $hasComment];
     }
     return $templates;
 }
예제 #23
0
 /**
  * @dataProvider supportedMethods
  *
  * @param string $method
  */
 public function testProcessValidDataWithTargetEntity($method)
 {
     $this->entity->setPhoneNumber('phone1');
     $targetEntity = new TestTarget(123);
     $targetEntity1 = new TestTarget(456);
     $this->request->query->set('entityClass', get_class($targetEntity));
     $this->request->query->set('entityId', $targetEntity->getId());
     $this->formFactory->expects($this->once())->method('createNamed')->with('orocrm_call_form', 'orocrm_call_form', $this->entity, [])->will($this->returnValue($this->form));
     $this->form->expects($this->once())->method('submit')->with($this->request);
     $this->form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->phoneProvider->expects($this->never())->method('getPhoneNumber');
     $this->phoneProvider->expects($this->once())->method('getPhoneNumbers')->with($this->identicalTo($targetEntity))->will($this->returnValue([['phone1', $targetEntity], ['phone2', $targetEntity], ['phone1', $targetEntity1]]));
     $this->entityRoutingHelper->expects($this->once())->method('getEntity')->with(get_class($targetEntity), $targetEntity->getId())->will($this->returnValue($targetEntity));
     // phone1, $targetEntity
     $this->callActivityManager->expects($this->at(0))->method('addAssociation')->with($this->identicalTo($this->entity), $this->identicalTo($targetEntity));
     // phone2, $targetEntity
     $this->callActivityManager->expects($this->at(1))->method('addAssociation')->with($this->identicalTo($this->entity), $this->identicalTo($targetEntity));
     // phone1, $targetEntity1
     $this->callActivityManager->expects($this->at(2))->method('addAssociation')->with($this->identicalTo($this->entity), $this->identicalTo($targetEntity1));
     $this->manager->expects($this->once())->method('persist')->with($this->entity);
     $this->manager->expects($this->once())->method('flush');
     $this->request->setMethod($method);
     $this->assertTrue($this->handler->process($this->entity));
 }
예제 #24
0
 /**
  * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
  * @expectedExceptionMessage Entity class "Acme\Bundle\TestClass" is not manageable.
  */
 public function testGetEntityReferenceForNewNotManageableEntity()
 {
     $this->doctrineHelper->expects($this->once())->method('createEntityInstance')->with('Acme\\Bundle\\TestClass')->will($this->throwException(new NotManageableEntityException('Acme\\Bundle\\TestClass')));
     $this->entityRoutingHelper->getEntityReference('Acme_Bundle_TestClass');
 }
예제 #25
0
 /**
  * @param string $entityClass
  * @param string $entityId
  * @return object
  */
 public function getTargetEntity($entityClass, $entityId)
 {
     return $this->entityRoutingHelper->getEntity($entityClass, $entityId);
 }
 /**
  * {@inheritdoc}
  */
 public function filter($rawValue, $operator)
 {
     return $this->helper->resolveEntityClass($rawValue);
 }
예제 #27
0
 /**
  * @param array $data
  *
  * @return string
  */
 protected function getRelatedActivityClass(array $data)
 {
     return $this->entityRoutingHelper->decodeClassName($data['activityType']['value'][0]);
 }
예제 #28
0
 /**
  * {@inheritDoc}
  */
 public function process(DatagridInterface $grid, array $config)
 {
     $parameters = $grid->getParameters();
     $this->object = $this->routingHelper->getEntity($parameters->get('entityClass'), $parameters->get('entityId'));
     $grid->setDatasource(clone $this);
 }