1 | <?php |
||
21 | class RecordHelper |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * The default scenario |
||
26 | */ |
||
27 | const DEFAULT_SCENARIO = self::SCENARIO_DEFAULT; |
||
28 | |||
29 | /** |
||
30 | * The scenario used by default |
||
31 | */ |
||
32 | const SCENARIO_DEFAULT = 'default'; |
||
33 | |||
34 | /** |
||
35 | * The scenario used to populate a model |
||
36 | */ |
||
37 | const SCENARIO_POPULATE = 'populate'; |
||
38 | |||
39 | /** |
||
40 | * The scenario used to insert a record |
||
41 | */ |
||
42 | const SCENARIO_INSERT = 'insert'; |
||
43 | |||
44 | /** |
||
45 | * The scenario used to update a record |
||
46 | */ |
||
47 | const SCENARIO_UPDATE = 'update'; |
||
48 | |||
49 | /** |
||
50 | * The scenario used to save a record |
||
51 | */ |
||
52 | const SCENARIO_SAVE = 'save'; |
||
53 | |||
54 | /** |
||
55 | * @param $config |
||
56 | * @param string|null $instanceOf |
||
57 | * @param string|null $toScenario |
||
58 | * @return Record |
||
59 | * @throws InvalidConfigException |
||
60 | */ |
||
61 | public static function create($config, string $instanceOf = null, string $toScenario = null) |
||
72 | |||
73 | /** |
||
74 | * @param Record $record |
||
75 | * @param array $properties |
||
76 | * @param string $toScenario |
||
77 | * @return Record |
||
78 | */ |
||
79 | public static function populate(Record $record, $properties = [], string $toScenario = null) |
||
96 | |||
97 | /** |
||
98 | * @param $condition |
||
99 | * @return array |
||
100 | */ |
||
101 | public static function conditionToCriteria($condition) |
||
117 | |||
118 | /** |
||
119 | * @param string|Record $record |
||
120 | * @param $criteria |
||
121 | * @return QueryInterface |
||
122 | */ |
||
123 | public static function configure($record, $criteria) |
||
135 | |||
136 | |||
137 | /** |
||
138 | * @return Transaction |
||
139 | */ |
||
140 | public static function beginTransaction() |
||
144 | } |
||
145 |