1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Pages;
13
14 use ICanBoogie\Errors;
15
16 class DeleteOperation extends \Icybee\Modules\Nodes\DeleteOperation
17 {
18 protected function validate(Errors $errors)
19 {
20 $nid = $this->key;
21
22 $count = $this->module->model->filter_by_parentid($nid)->count;
23
24 if ($count)
25 {
26 $errors[] = $errors->format('This page has :count direct children.', array(':count' => $count));
27 }
28
29 $count = $this->module->model->filter_by_locationid($nid)->count;
30
31 if ($count)
32 {
33 $errors[] = $errors->format('This page is used in :count redirections.', array(':count' => $count));
34 }
35
36 return parent::validate($errors);
37 }
38 }