/** * {@inheritdoc} */ public function setColumnTransformers(array $transformers = []) { $collection = new ColumnTransformerCollection(); foreach ($transformers as $column => $transformer) { $collection->add($column, $transformer); } $this->dataset->setDefaultContextOption('column_transformers', $collection); }
/** * {@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]); }
public function getGlobals() { return ['cart' => $this->cartContext->getCurrentCart(), 'cartProducts' => $this->cartProductDataSet->getResult('array')]; }
/** * 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'); }
/** * @return array */ public function getCmsPages() { return $this->dataset->getResult('tree', ['order_by' => 'hierarchy']); }
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'])]; }
public function setCacheOptions(CacheOptions $options) { $this->dataset->setCacheOptions($options); }
public function getCurrentCartProducts() { return $this->cartProductDataSet->getResult('array', [], ['pagination' => false]); }
/** * {@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]); }
/** * 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']); }