-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw exception when cast class is not existed. (#6010)
Co-authored-by: 李铭昕 <715557344@qq.com>
- Loading branch information
1 parent
bcc5cf3
commit 7c4c00e
Showing
3 changed files
with
55 additions
and
3 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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact group@hyperf.io | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace Hyperf\Database\Exception; | ||
|
||
use RuntimeException; | ||
|
||
class InvalidCastException extends RuntimeException | ||
{ | ||
/** | ||
* @param string $model the name of the affected model | ||
* @param string $column the name of the column | ||
* @param string $castType the name of the cast type | ||
*/ | ||
public function __construct(public string $model, public string $column, public string $castType) | ||
{ | ||
parent::__construct("Call to undefined cast [{$castType}] on column [{$column}] in model [{$model}]."); | ||
} | ||
} |
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