1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @package Spark |
5
|
|
|
* @author Flipbox Factory <[email protected]> |
6
|
|
|
* @copyright 2010-2016 Flipbox Digital Limited |
7
|
|
|
* @license https://github.com/FlipboxFactory/Craft3-Spark/blob/master/LICENSE |
8
|
|
|
* @link https://github.com/FlipboxFactory/Craft3-Spark |
9
|
|
|
* @since Class available since Release 1.0.0 |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace flipbox\spark\services\traits; |
13
|
|
|
|
14
|
|
|
use flipbox\spark\behaviors\ObjectRecordAccessor as ObjectRecordAccessorBehavior; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @method getRecordQuery($config = []): ActiveQuery |
18
|
|
|
* @method createRecord(array $attributes = [], string $toScenario = null): Record |
19
|
|
|
* @method findRecordByCondition($condition, string $toScenario = null) |
20
|
|
|
* @method findRecordByCriteria($criteria, string $toScenario = null) |
21
|
|
|
* @method getRecordByCondition($condition, string $toScenario = null): Record |
22
|
|
|
* @method getRecordByCriteria($criteria, string $toScenario = null): Record |
23
|
|
|
* @method findAllRecords(string $toScenario = null): array |
24
|
|
|
* @method findAllRecordsByCondition($condition, string $toScenario = null):array |
25
|
|
|
* @method findAllRecordsByCriteria($criteria, string $toScenario = null): array |
26
|
|
|
* @method getAllRecords(string $toScenario = null): array |
27
|
|
|
* @method getAllRecordsByCondition($condition, string $toScenario = null):array |
28
|
|
|
* @method getAllRecordsByCriteria($criteria, string $toScenario = null): array |
29
|
|
|
* @method findRecordById(int $id, string $toScenario = null) |
30
|
|
|
* @method getRecordById(int $id, string $toScenario = null): Record |
31
|
|
|
* |
32
|
|
|
*/ |
33
|
|
|
trait ObjectRecordBehavior |
34
|
|
|
{ |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @return string |
38
|
|
|
*/ |
39
|
|
|
public abstract static function recordClass(): string; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @inheritdoc |
43
|
|
|
*/ |
44
|
|
|
public function behaviors() |
45
|
|
|
{ |
46
|
|
|
return [ |
47
|
|
|
'record' => [ |
48
|
|
|
'class' => ObjectRecordAccessorBehavior::class, |
49
|
|
|
'record' => static::recordClass() |
50
|
|
|
] |
51
|
|
|
]; |
52
|
|
|
} |
53
|
|
|
} |