diff --git a/src/Model/BlogCategory.php b/src/Model/BlogCategory.php index ae69c7de..78ac2647 100644 --- a/src/Model/BlogCategory.php +++ b/src/Model/BlogCategory.php @@ -55,6 +55,17 @@ class BlogCategory extends DataObject implements CategorisationObject 'BlogPosts' => BlogPost::class, ]; + public function validate() + { + $result = parent::validate(); + + if(empty($this->Title)) { + $result->addError(_t(__CLASS__ . '.TitleNotEmpty', 'Title must not be empty')); + } + + return $result; + } + /** * {@inheritdoc} */ diff --git a/src/Model/BlogTag.php b/src/Model/BlogTag.php index 4180f67d..f8b509dc 100644 --- a/src/Model/BlogTag.php +++ b/src/Model/BlogTag.php @@ -55,6 +55,17 @@ class BlogTag extends DataObject implements CategorisationObject 'BlogPosts' => BlogPost::class ]; + public function validate() + { + $result = parent::validate(); + + if(empty($this->Title)) { + $result->addError(_t(__CLASS__ . '.TitleNotEmpty', 'Title must not be empty')); + } + + return $result; + } + /** * {@inheritdoc} */