Issues (35)

src/interfaces/ModelInterface.php (1 issue)

1
<?php
2
3
namespace Itstructure\AdminModule\interfaces;
4
5
/**
6
 * Interface ModelInterface
7
 *
8
 * @package Itstructure\AdminModule\interfaces
9
 *
10
 * @author Andrey Girnik <[email protected]>
11
 */
12
interface ModelInterface
13
{
14
    /**
15
     * Scripts Constants.
16
     * Required for certain validation rules to work for specific scenarios.
17
     */
18
    const SCENARIO_CREATE = 'create';
19
    const SCENARIO_UPDATE = 'update';
20
21
    /**
22
     * Save data.
23
     *
24
     * @return bool
25
     */
26
    public function save();
27
28
    /**
29
     * Returns current model id.
30
     *
31
     * @return int|string
32
     */
33
    public function getId();
34
35
    /**
36
     * Load data.
37
     * Used from the parent model yii\base\Model.
38
     *
39
     * @param $data
40
     * @param null $formName
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $formName is correct as it would always require null to be passed?
Loading history...
41
     *
42
     * @return bool
43
     */
44
    public function load($data, $formName = null);
45
46
    /**
47
     * Sets the attribute values in a massive way.
48
     * Used from the parent model yii\base\Model.
49
     *
50
     * @param array $values attribute values (name => value) to be assigned to the model.
51
     * @param bool $safeOnly whether the assignments should only be done to the safe attributes.
52
     */
53
    public function setAttributes($values, $safeOnly = true);
54
}
55