protected function setUp()
 {
     parent::setUp();
     $this->purgeDatabase();
     $this->em = $this->getContainer()->get('doctrine.orm.default_entity_manager');
     $this->dependencyManager = $this->getContainer()->get('sulu_sales_core.dependency_manager');
     $this->dependencyManager->addMapping(OrderAddress::class, ['icon' => 'fa_icon_bug', 'alias' => 'orderAddress']);
     $this->transitionResolver = $this->getContainer()->get('sulu_sales_core.transition_resolver');
     $this->createFixtures();
 }
Beispiel #2
0
 /**
  * @param string $alias
  * @param int $id
  * @param string $hydrationMode
  *
  * @return TransitionResult
  */
 protected function createTransitionResult($alias, $id, $hydrationMode)
 {
     $parameters = $this->dependencyManager->getParametersForAlias($alias);
     $transitionResult = new TransitionResult();
     $transitionResult->setDestinationId($id);
     $this->setParameters($transitionResult, $parameters, $id);
     $number = null;
     $created = null;
     if ($hydrationMode == self::HYDRATION_MODE_OBJECTS) {
         /** @var EntityRepository $entityRepository */
         $entityRepository = $this->entityManager->getRepository($parameters['class']);
         $entity = $entityRepository->find($id);
         if (!$entity) {
             return null;
         }
         if (method_exists($entity, 'getNumber')) {
             $number = $entity->getNumber();
         }
         if (method_exists($entity, 'getCreated')) {
             $created = $entity->getCreated();
         }
     }
     $transitionResult->setNumber($number);
     $transitionResult->setCreated($created);
     return $transitionResult;
 }