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);
 }
Esempio 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);
 }
 /**
  * {@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);
 }
 /**
  * {@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]);
 }
 public function getCurrentOrderProducts() : array
 {
     return $this->orderProductDataSet->getResult('array', [], ['pagination' => false]);
 }
Esempio n. 7
0
 public function getGlobals()
 {
     return ['cart' => $this->cartContext->getCurrentCart(), 'cartProducts' => $this->cartProductDataSet->getResult('array')];
 }
Esempio 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]);
 }
 public function getShops() : array
 {
     return $this->shopDataset->getResult('select');
 }
Esempio n. 10
0
 /**
  * @return array
  */
 public function getCmsPages()
 {
     return $this->dataset->getResult('tree', ['order_by' => 'hierarchy']);
 }
Esempio n. 11
0
 public function getGlobals()
 {
     return ['currencies' => $this->dataset->getResult('select', ['order_by' => 'code'], ['label_column' => 'code'])];
 }
 /**
  * {@inheritdoc}
  */
 public function getLocales() : array
 {
     return ['locales' => $this->dataset->getResult('select', ['order_by' => 'code'], ['label_column' => 'code', 'value_column' => 'code'])];
 }
Esempio n. 13
0
 public function setCacheOptions(CacheOptions $options)
 {
     $this->dataset->setCacheOptions($options);
 }
Esempio n. 14
0
 public function getCurrentCartProducts()
 {
     return $this->cartProductDataSet->getResult('array', [], ['pagination' => false]);
 }
Esempio 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]);
 }
Esempio 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]);
 }
 /**
  * Returns an array of currencies
  *
  * @return array
  */
 public function getCurrencies() : array
 {
     return $this->dataset->getResult('select', ['order_by' => 'code'], ['label_column' => 'code']);
 }