/** * {@inheritdoc} */ public function readConfiguration(DataGridEventInterface $event) { $dataGrid = $event->getDataGrid(); $dataGridConfiguration = array(); foreach ($this->kernel->getBundles() as $bundle) { if ($this->hasDataGridConfiguration($bundle->getPath(), $dataGrid->getName())) { $configuration = $this->getDataGridConfiguration($bundle->getPath(), $dataGrid->getName()); if (is_array($configuration)) { $dataGridConfiguration = $configuration; } } } if (count($dataGridConfiguration)) { $this->buildConfiguration($dataGrid, $dataGridConfiguration); } }
/** * {@inheritdoc} */ public function preBindData(DataGridEventInterface $event) { $dataGrid = $event->getDataGrid(); $request = $event->getData(); if (!$request instanceof Request) { return; } $name = $dataGrid->getName(); $default = array(); switch ($request->getMethod()) { case 'POST': case 'PUT': case 'DELETE': case 'PATCH': $data = $request->request->get($name, $default); break; case 'GET': $data = $request->query->get($name, $default); break; default: throw new DataGridException(sprintf('The request method "%s" is not supported', $request->getMethod())); } $event->setData($data); }