@@ 8-35 (lines=28) @@ | ||
5 | use Rudolf\Component\Alerts\Alert; |
|
6 | use Rudolf\Component\Alerts\AlertsCollection; |
|
7 | ||
8 | class AddForm extends FormCheck |
|
9 | { |
|
10 | /** |
|
11 | * @var AddModel |
|
12 | */ |
|
13 | protected $model; |
|
14 | ||
15 | public function setModel(AddModel $model) |
|
16 | { |
|
17 | $this->model = $model; |
|
18 | } |
|
19 | ||
20 | /** |
|
21 | * @return int |
|
22 | */ |
|
23 | public function add() |
|
24 | { |
|
25 | $status = $this->model->add($this->dataValidated); |
|
26 | ||
27 | if ($status) { |
|
28 | AlertsCollection::add(new Alert( |
|
29 | 'success', 'Pomyślnie dodano galerię.' |
|
30 | )); |
|
31 | } |
|
32 | ||
33 | return $status; |
|
34 | } |
|
35 | } |
|
36 |
@@ 8-35 (lines=28) @@ | ||
5 | use Rudolf\Component\Alerts\Alert; |
|
6 | use Rudolf\Component\Alerts\AlertsCollection; |
|
7 | ||
8 | class EditForm extends FormCheck |
|
9 | { |
|
10 | /** |
|
11 | * @var EditModel |
|
12 | */ |
|
13 | protected $model; |
|
14 | ||
15 | public function setModel(EditModel $model) |
|
16 | { |
|
17 | $this->model = $model; |
|
18 | } |
|
19 | ||
20 | /** |
|
21 | * @return int |
|
22 | */ |
|
23 | public function update() |
|
24 | { |
|
25 | $status = $this->model->update($this->dataValidated); |
|
26 | ||
27 | if ($status) { |
|
28 | AlertsCollection::add(new Alert( |
|
29 | 'success', 'Pomyślnie zmodyfikowano galerię.' |
|
30 | )); |
|
31 | } |
|
32 | ||
33 | return $status; |
|
34 | } |
|
35 | } |
|
36 |