-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add OrgNameValidator to validate organization name
- Loading branch information
Showing
4 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Domain\Common\Exceptions; | ||
|
||
use RuntimeException; | ||
|
||
class BusinessException extends RuntimeException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace App\Domain\Common\Validators; | ||
|
||
class Validator | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
add<?php | ||
|
||
namespace App\Domain\OrgMng\Org\Validator; | ||
|
||
use App\Domain\Common\Exceptions\BusinessException; | ||
|
||
class OrgNameValidator | ||
{ | ||
public function verify(int $tenantId, int $superiorId, string $name) | ||
{ | ||
$this->nameShouldNotEmpty($name); | ||
$this->nameShouldNotDuplicatedInSameSuperior($tenantId, $superiorId, $name); | ||
} | ||
|
||
private function nameShouldNotEmpty(string $name) | ||
{ | ||
if (empty($name)) { | ||
throw new BusinessException("组织名不能为空"); | ||
} | ||
} | ||
|
||
private function nameShouldNotDuplicatedInSameSuperior(int $tenantId, int $superiorId, string $name) | ||
{ | ||
|
||
} | ||
} |