createContext() 공개 메소드

Creates a dataset's context using factory service
public createContext ( string $contextType, array $options = [] ) : WellCommerce\Component\DataSet\Context\DataSetContextInterface
$contextType string
$options array
리턴 WellCommerce\Component\DataSet\Context\DataSetContextInterface
예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getResult($contextType, array $requestOptions = [], array $contextOptions = [])
 {
     $contextOptions = $this->getContextOptions($contextOptions);
     $requestOptions = $this->getRequestOptions($requestOptions);
     $context = $this->manager->createContext($contextType, $contextOptions);
     $request = $this->manager->createRequest($requestOptions);
     $queryBuilder = $this->getQueryBuilder($request);
     return $context->getResult($queryBuilder, $request, $this->columns);
 }
예제 #2
0
 public function getResult(string $contextType, array $requestOptions = [], array $contextOptions = []) : array
 {
     $contextOptions = $this->getContextOptions($contextOptions);
     $requestOptions = $this->getRequestOptions($requestOptions);
     $context = $this->manager->createContext($contextType, $contextOptions);
     $request = $this->getDataSetRequest($requestOptions);
     $queryBuilder = $this->getQueryBuilder($request);
     try {
         return $context->getResult($queryBuilder, $request, $this->columns, $this->cacheOptions);
     } catch (\Exception $e) {
         return ['error' => $e->getMessage()];
     }
 }
예제 #3
0
 public function getResult(string $contextType, array $requestOptions = [], array $contextOptions = []) : array
 {
     $this->getDoctrineHelper()->enableFilter('locale')->setParameter('locale', $this->getRequestHelper()->getCurrentLocale());
     $contextOptions = $this->getContextOptions($contextOptions);
     $requestOptions = $this->getRequestOptions($requestOptions);
     $context = $this->manager->createContext($contextType, $contextOptions);
     $request = $this->getDataSetRequest($requestOptions);
     $queryBuilder = $this->getQueryBuilder($request);
     try {
         $result = $context->getResult($queryBuilder, $request, $this->columns, $this->cacheOptions);
     } catch (\Exception $e) {
         $result = ['error' => $e->getMessage()];
     }
     $this->getDoctrineHelper()->disableFilter('locale');
     return $result;
 }