public function configure() { $adminCode = $this->container->get('request')->get('_sonata_admin'); if ($adminCode) { parent::configure(); } }
/** * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function configure() { parent::configure(); $this->admin->getRequestParameters($this->getRequest()); if (empty($this->admin->client_id)) { throw new NotFoundHttpException('Unable load page with no client_id'); } $this->client_id = $this->admin->client_id; $this->client = $this->getDoctrine()->getManager()->getRepository('ApplicationSonataClientBundle:Client')->find($this->client_id); if (empty($this->client)) { throw new NotFoundHttpException(sprintf('unable to find Client with id : %s', $this->admin->client_id)); } $this->_month = $this->admin->month; $this->_query_month = $this->admin->query_month; $this->_year = $this->admin->year; $this->_show_all_operations = $this->admin->_show_all_operations; $this->_parameters_url['filter']['client_id']['value'] = $this->client_id; if ($this->admin->setQueryMonth()) { $this->_parameters_url['month'] = $this->_query_month; } if ($this->_query_month == -1 && $this->_show_all_operations) { $this->_parameters_url['month'] = 'all'; } //$this->get('request')->setLocale(strtolower($this->client->getLanguage())); }
public function configure() { parent::configure(); $this->admin->setUniqid('news'); $templates = $this->admin->getTemplates(); $templates['edit'] = 'CMSNewsBundle:Admin:edit.html.twig'; $this->admin->setTemplates($templates); }
public function configure() { parent::configure(); if (empty($this->admin->client_id)) { throw new NotFoundHttpException('Unable load page with no client_id'); } $this->client_id = $this->admin->client_id; $this->client = $this->admin->getClient(); if (empty($this->client)) { throw new NotFoundHttpException(sprintf('unable to find Client with id : %s', $this->admin->client_id)); } }
/** * Contextualize the admin class depends on the current request. * * @throws \RuntimeException */ protected function configure() { parent::configure(); $this->appadmin = $this->container->get('sonata.admin.pool')->getAdminByAdminCode('sonata.admin.application'); if (!$this->appadmin) { throw new \RuntimeException(sprintf('Unable to find the admin class related to the current controller (%s)', get_class($this))); } $rootAdmin = $this->appadmin; if ($this->appadmin->isChild()) { $this->appadmin->setCurrentChild(true); $rootAdmin = $rootAdmin->getParent(); } $request = $this->container->get('request'); $rootAdmin->setRequest($request); if ($request->get('uniqid')) { $this->appadmin->setUniqid($request->get('uniqid')); } }
/** * Set up the lasted edited dispatcher */ public function configure() { parent::configure(); $this->dispatcher = $this->get('networking_init_cms.event_dispatcher'); /** @var \Symfony\Component\HttpFoundation\Session\Session $session */ $session = $this->get('session'); switch (strtolower($this->container->getParameter('networking_init_cms.db_driver'))) { case 'monodb': $lastEditedSubscriber = new ODMLastEditedListener($session); break; case 'orm': $lastEditedSubscriber = new ORMLastEditedListener($session); break; default: $lastEditedSubscriber = false; break; } if ($lastEditedSubscriber) { $this->dispatcher->addSubscriber($lastEditedSubscriber); } }
/** * {@inheritdoc} */ protected function configure() { parent::configure(); if (!$this->admin instanceof AbstractAdmin) { $adminClass = get_class($this->admin); $msg = sprintf('The admin "%s" is not a valid admin, should extends from "%s"', $adminClass, AbstractAdmin::class); throw new \InvalidArgumentException($msg); } }