1 | <?php |
||
23 | trait CrudCommonMethods |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Get the plural name of the entity |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | 4 | protected function getEntityNamePlural() |
|
41 | |||
42 | /** |
||
43 | * Get entity singular name used on controller actions |
||
44 | * |
||
45 | * @return string |
||
46 | */ |
||
47 | 8 | protected function getEntityNameSingular() |
|
53 | |||
54 | /** |
||
55 | * Gets updated HTTP request |
||
56 | * |
||
57 | * @return ServerRequestInterface|Request |
||
58 | */ |
||
59 | abstract public function getRequest(); |
||
60 | |||
61 | /** |
||
62 | * Sets a value to be used by render |
||
63 | * |
||
64 | * The key argument can be an associative array with values to be set |
||
65 | * or a string naming the passed value. If an array is given then the |
||
66 | * value will be ignored. |
||
67 | * |
||
68 | * Those values must be set in the request attributes so they can be used |
||
69 | * latter by any other middle ware in the stack. |
||
70 | * |
||
71 | * @param string|array $key |
||
72 | * @param mixed $value |
||
73 | * |
||
74 | * @return ControllerInterface |
||
75 | */ |
||
76 | abstract public function set($key, $value = null); |
||
77 | |||
78 | /** |
||
79 | * Gets the entity FQ class name |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | abstract public function getEntityClassName(); |
||
84 | |||
85 | /** |
||
86 | * Redirects the flow to another route/path |
||
87 | * |
||
88 | * @param string $path the route or path to redirect to |
||
89 | * |
||
90 | * @return ControllerInterface|self|$this |
||
91 | */ |
||
92 | abstract public function redirect($path); |
||
93 | } |