1 | <?php |
||
21 | final class EditViewModel implements TemplateViewModelInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var FormInterface |
||
25 | */ |
||
26 | private $form; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $postSlug; |
||
32 | |||
33 | /** |
||
34 | * The view model constructor depends on the most raw elements possible. |
||
35 | */ |
||
36 | public function __construct(string $postSlug, FormInterface $form) |
||
41 | |||
42 | /** |
||
43 | * We create named constructors for the cases where we need to extract the raw data from complex data structures. |
||
44 | */ |
||
45 | public static function fromPostAndForm(Post $post, FormInterface $form): self |
||
49 | |||
50 | public function getForm(): FormInterface |
||
54 | |||
55 | public function getPostSlug(): string |
||
59 | } |
||
60 |