-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModelInterface.php
39 lines (34 loc) · 987 Bytes
/
ModelInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
namespace Horat1us\Yii\Validation\Failure;
use Horat1us\Yii\Validation;
use yii\base;
/**
* Interface ModelInterface
* @package Horat1us\Yii\Validation\Exception
*
* Extension for
* @see base\Model
*/
interface ModelInterface
{
/**
* This method SHALL validate model or throw failure exception.
* @see \yii\base\Model::validate() should be used in implementation
*
* @param string[]|null $attributeNames
* @param bool $clearErrors
*
* @throws Validation\Failure
*/
public function validateOrFail(array $attributeNames = null, bool $clearErrors = true): void;
/**
* This method SHALL check for errors in model and throw failure exception if they present.
* @see \yii\base\Model::hasErrors() should be used in implementation
*
* @param string|null $attribute
*
* @throws Validation\Failure
*/
public function checkOrFail(string $attribute = null): void;
}