| 1 | <?php |
||
| 9 | class AbstractController extends Controller |
||
| 10 | { |
||
| 11 | use LegacyTemplateTrait; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Sets the container. |
||
| 15 | * |
||
| 16 | * There is no container available in the constructor of a controller, so we override setContainer() and use this |
||
| 17 | * |
||
| 18 | * @param \Symfony\Component\DependencyInjection\ContainerInterface|null $container A ContainerInterface instance or null. |
||
| 19 | * |
||
| 20 | * @return void |
||
| 21 | */ |
||
| 22 | public function setContainer(ContainerInterface $container = null) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $message |
||
| 36 | * |
||
| 37 | * @return void |
||
| 38 | */ |
||
| 39 | protected function addErrorMessage($message) |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $message |
||
| 46 | * |
||
| 47 | * @return void |
||
| 48 | */ |
||
| 49 | protected function addSuccessMessage($message) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param string $message |
||
| 56 | * |
||
| 57 | * @return void |
||
| 58 | */ |
||
| 59 | protected function addInfoMessage($message) |
||
| 63 | } |
||
| 64 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: