Author: Adam Piotrowski (adam@wellcommerce.org)
 /**
  * {@inheritdoc}
  */
 public function setColumnTransformers(array $transformers = [])
 {
     $collection = new ColumnTransformerCollection();
     foreach ($transformers as $column => $transformer) {
         $collection->add($column, $transformer);
     }
     $this->dataset->setDefaultContextOption('column_transformers', $collection);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function loadResults(Request $request)
 {
     $page = $request->request->get('starting_from') / $request->request->get('limit') + 1;
     $conditions = new ConditionsCollection();
     $conditionsResolver = new ConditionsResolver();
     $conditionsResolver->resolveConditions($request->request->get('where'), $conditions);
     $requestOptions = ['page' => $page, 'limit' => $request->request->get('limit'), 'order_by' => $request->request->get('order_by'), 'order_dir' => $request->request->get('order_dir'), 'conditions' => $conditions];
     return $this->dataset->getResult('datagrid', $requestOptions);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function handleListRequest(Request $request)
 {
     $conditions = new ConditionsCollection();
     $conditionsResolver = new ConditionsResolver();
     $conditionsResolver->resolveConditions($request->request->get('where'), $conditions);
     $result = $this->dataset->getResult('array', ['limit' => $request->request->get('limit', $this->options['limit']), 'page' => $request->request->get('page', $this->options['page']), 'order_by' => $request->request->get('order_by', $this->options['order_by']), 'order_dir' => $request->request->get('order_dir', $this->options['order_dir']), 'conditions' => $conditions]);
     $data = $this->serializer->serialize($result, self::RESPONSE_FORMAT);
     return new Response($data);
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function loadResults(Request $request)
 {
     $page = $request->request->get('starting_from', 0) / $request->request->get('limit', 10) + 1;
     $conditions = new ConditionsCollection();
     $conditionsResolver = new ConditionsResolver();
     $conditionsResolver->resolveConditions($request->request->get('where'), $conditions);
     $requestOptions = ['page' => $page, 'limit' => $request->request->get('limit', 10), 'order_by' => $request->request->get('order_by', 'id'), 'order_dir' => $request->request->get('order_dir', 'desc'), 'conditions' => $conditions];
     try {
         $results = $this->dataset->getResult('datagrid', $requestOptions);
     } catch (\Exception $e) {
         $results = nl2br($e->getMessage());
     }
     return $results;
 }
 public function getProducers(int $limit = 10, string $orderBy = 'name', string $orderDir = 'asc') : array
 {
     return $this->dataset->getResult('array', ['limit' => $limit, 'order_by' => $orderBy, 'order_dir' => $orderDir], ['pagination' => false]);
 }
Exemplo n.º 6
0
 public function getCurrentOrderProducts() : array
 {
     return $this->orderProductDataSet->getResult('array', [], ['pagination' => false]);
 }
Exemplo n.º 7
0
 public function getGlobals()
 {
     return ['cart' => $this->cartContext->getCurrentCart(), 'cartProducts' => $this->cartProductDataSet->getResult('array')];
 }
Exemplo n.º 8
0
 /**
  * Returns a dataset of products recommended for category
  *
  * @param CategoryInterface $category
  *
  * @return array
  */
 public function getProductRecommendationsForCategory(CategoryInterface $category)
 {
     $conditions = new ConditionsCollection();
     $conditions->add(new Eq('category', $category->getId()));
     return $this->dataset->getResult('datagrid', ['limit' => 3, 'order_by' => 'name', 'order_dir' => 'asc', 'conditions' => $conditions]);
 }
Exemplo n.º 9
0
 public function getShops() : array
 {
     return $this->shopDataset->getResult('select');
 }
Exemplo n.º 10
0
 /**
  * @return array
  */
 public function getCmsPages()
 {
     return $this->dataset->getResult('tree', ['order_by' => 'hierarchy']);
 }
Exemplo n.º 11
0
 public function getGlobals()
 {
     return ['currencies' => $this->dataset->getResult('select', ['order_by' => 'code'], ['label_column' => 'code'])];
 }
Exemplo n.º 12
0
 /**
  * {@inheritdoc}
  */
 public function getLocales() : array
 {
     return ['locales' => $this->dataset->getResult('select', ['order_by' => 'code'], ['label_column' => 'code', 'value_column' => 'code'])];
 }
Exemplo n.º 13
0
 public function setCacheOptions(CacheOptions $options)
 {
     $this->dataset->setCacheOptions($options);
 }
Exemplo n.º 14
0
 public function getCurrentCartProducts()
 {
     return $this->cartProductDataSet->getResult('array', [], ['pagination' => false]);
 }
Exemplo n.º 15
0
 /**
  * {@inheritdoc}
  */
 public function getGlobals()
 {
     return ['taxes' => $this->dataset->getResult('select')];
 }
 /**
  * Returns product statuses
  *
  * @param int    $limit
  * @param string $orderBy
  * @param string $orderDir
  *
  * @return array
  */
 public function getProductStatuses($limit = 5, $orderBy = 'name', $orderDir = 'asc')
 {
     return $this->dataset->getResult('array', ['limit' => $limit, 'order_by' => $orderBy, 'order_dir' => $orderDir]);
 }
Exemplo n.º 17
0
 /**
  * Returns categories tree
  *
  * @param int    $limit
  * @param string $orderBy
  * @param string $orderDir
  *
  * @return array
  */
 public function getCategoriesTree($limit = 10, $orderBy = 'hierarchy', $orderDir = 'asc')
 {
     return $this->dataset->getResult('tree', ['limit' => $limit, 'order_by' => $orderBy, 'order_dir' => $orderDir]);
 }
Exemplo n.º 18
0
 /**
  * Returns an array of currencies
  *
  * @return array
  */
 public function getCurrencies() : array
 {
     return $this->dataset->getResult('select', ['order_by' => 'code'], ['label_column' => 'code']);
 }