1 | <?php |
||
23 | trait FormActionControllerTrait |
||
24 | { |
||
25 | /** |
||
26 | * In case an exception (any exception type) is thrown during the |
||
27 | * middlewares execution, it can be automatically caught by FormZ, and the |
||
28 | * request will be forwarded to an action of the controller. |
||
29 | * |
||
30 | * You can use it for instance to log your exception in some log service; to |
||
31 | * render a view that contains a message explaining to the user that |
||
32 | * something went wrong. |
||
33 | * |
||
34 | * Just fill the property below with the name of an existing action of the |
||
35 | * controller. The method will have a single parameter which is the |
||
36 | * exception. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $actionForException; |
||
41 | |||
42 | /** |
||
43 | * @todo |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $formScope = MainScope::class; |
||
48 | |||
49 | /** |
||
50 | * IMPORTANT: if you need to override this method in your own controller, do |
||
51 | * not forget to call `parent::initializeAction()`! |
||
52 | */ |
||
53 | private function initializeFormz() |
||
74 | } |
||
75 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: