их непосредственного изменения • 2. Вынесение кода часто-используемых действий. Например, установка значений created_at и updated_at • 3. Создание очередей и сбор данных по ходу исполнения кода
don't do anything if it's not the master request return; } $this->banners = $this->em ->getRepository('AppBannerBundle:Banner')->findByPlaces(); } public function getBanner($place) { return isset($this->banners[$place]) ? $this->banners[$place] : null; } $this->get('app.listener.banner')->getBanner($place); Система баннеров
// don't do anything if it's not the master request return; } $context = $this->router->getContext(); $request = $event->getRequest(); if ($request->get('_city')) { $context->setParameter('_city', true); } } Установка параметра для всех ссылок
return; } $method = new \ReflectionMethod($controller[0], $controller[1]); foreach ($this->reader->getMethodAnnotations($method) as $annotation) { if ($annotation instanceof MinAccess) { if (!$annotation->execute( $this->security, $this->session, $this->routing) ) { throw new MinAccessException(); } } } } Расширение метода с помощью аннотаций
instanceof MinAccessException) { $event->setResponse( new RedirectResponse($this->routing->generate('address_edit') )); } } Расширение метода с помощью аннотаций