File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 6363
6464 ->set ('request_stack ' , RequestStack::class)
6565 ->call ('push ' , [service ('module_request ' )])
66+ ->public ()
67+
6668 ->set ('event_dispatcher ' , EventDispatcher::class)
6769
6870 ->set ('module_request ' , Request::class)
Original file line number Diff line number Diff line change 1515use Symfony \Component \DependencyInjection \Loader \PhpFileLoader ;
1616use Symfony \Component \DependencyInjection \Loader \YamlFileLoader ;
1717use Symfony \Component \DependencyInjection \Reference ;
18+ use Symfony \Component \HttpFoundation \Session \Flash \FlashBagInterface ;
19+ use Symfony \Component \HttpFoundation \Session \Session ;
1820use Symfony \Component \Mailer \Bridge \Google \Transport \GmailTransportFactory ;
1921use Symfony \Component \Mailer \Mailer ;
2022use Symfony \Component \Notifier \Recipient \Recipient ;
@@ -176,6 +178,21 @@ class_exists(\Twig\Environment::class)
176178 static ::$ container ->compile (true );
177179 }
178180
181+ /**
182+ * Flashes.
183+ *
184+ * @return FlashBagInterface
185+ * @throws Exception
186+ */
187+ public static function getFlashBag () : FlashBagInterface
188+ {
189+ $ container = static ::getInstance ();
190+ /** @var Session $session */
191+ $ session = $ container ->get ('session_instance ' );
192+
193+ return $ session ->getFlashBag ();
194+ }
195+
179196 /**
180197 * Обработка классов как сервисов из битриксового конфига. Раздел services.
181198 *
Original file line number Diff line number Diff line change @@ -176,3 +176,12 @@ return [
176176Параметр (массив) ` compile_container_envs ` указывает окружения, при которых необходимо кэшировать контейнер.
177177
178178Пока простая логика: ` $_ENV["DEBUG"] === true ` => окружение ` dev ` , иначе ` prod ` .
179+
180+ ## Прочее
181+
182+ #### FlashBag
183+
184+ Для обработки отправок в канал ` browser ` . Два варианта:
185+
186+ - публичный сервис ` session_instance ` вернет экземпляр сессии, а там есть метод ` getFlashBag ` .
187+ - хэлпер ` \Proklung\Notifier\DI\Services::getFlashBag() ` , делающий тоже самое.
You can’t perform that action at this time.
0 commit comments