| @@ 50-60 (lines=11) @@ | ||
| 47 | ]); |
|
| 48 | } |
|
| 49 | ||
| 50 | public function validation() |
|
| 51 | { |
|
| 52 | $validator = new Validation(); |
|
| 53 | $validator->add('slug', new UniquenessValidator( |
|
| 54 | [ |
|
| 55 | "model" => $this, |
|
| 56 | "message" => "Тип публикаций с таким URL раздела = '" . $this->slug . "' уже существует" |
|
| 57 | ] |
|
| 58 | )); |
|
| 59 | return $this->validate($validator); |
|
| 60 | } |
|
| 61 | ||
| 62 | public function afterUpdate() |
|
| 63 | { |
|
| @@ 45-55 (lines=11) @@ | ||
| 42 | $this->hasMany("id", $this->translateModel, "foreign_id"); // translate |
|
| 43 | } |
|
| 44 | ||
| 45 | public function validation() |
|
| 46 | { |
|
| 47 | $validator = new Validation(); |
|
| 48 | $validator->add('slug', new UniquenessValidator( |
|
| 49 | [ |
|
| 50 | "model" => $this, |
|
| 51 | "message" => "Category with slug '" . $this->slug . "' is already exists. Take another title" |
|
| 52 | ] |
|
| 53 | )); |
|
| 54 | return $this->validate($validator); |
|
| 55 | } |
|
| 56 | ||
| 57 | public function beforeCreate() |
|
| 58 | { |
|