mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 14:50:39 -04:00
Validate Collection name
This commit is contained in:
parent
2aae231710
commit
221c2ff347
2 changed files with 12 additions and 0 deletions
|
@ -55,6 +55,11 @@ class Collection{
|
|||
public function Validate(): void{
|
||||
$error = new Exceptions\ValidationException();
|
||||
|
||||
$this->Name = trim($this->Name ?? '');
|
||||
if($this->Name == ''){
|
||||
$error->Add(new Exceptions\CollectionNameRequiredException());
|
||||
}
|
||||
|
||||
if(strlen($this->Name) > EBOOKS_MAX_STRING_LENGTH){
|
||||
$error->Add(new Exceptions\StringTooLongException('Collection name: '. $this->Name));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue