13
13
14
14
/**
15
15
* Interface CastInterface
16
+ *
17
+ * [App Code] --- set() --> [Entity] --- toDatabase() ---> [Database]
18
+ * [App Code] <-- get() --- [Entity] <-- fromDatabase() -- [Database]
16
19
*/
17
20
interface CastInterface
18
21
{
19
22
/**
20
- * Get
23
+ * Returns value when getting the Entity property.
24
+ * This method is normally returns the value as it is.
21
25
*
22
26
* @param array|bool|float|int|object|string|null $value Data
23
27
* @param array $params Additional param
@@ -27,12 +31,32 @@ interface CastInterface
27
31
public static function get ($ value , array $ params = []);
28
32
29
33
/**
30
- * Set
34
+ * Returns value for the Entity property when setting the Entity property.
31
35
*
32
36
* @param array|bool|float|int|object|string|null $value Data
33
37
* @param array $params Additional param
34
38
*
35
39
* @return array|bool|float|int|object|string|null
36
40
*/
37
41
public static function set ($ value , array $ params = []);
42
+
43
+ /**
44
+ * Takes the Entity property value, returns its value for database.
45
+ *
46
+ * @param array|bool|float|int|object|string|null $value Data
47
+ * @param array $params Additional param
48
+ *
49
+ * @return bool|float|int|string|null
50
+ */
51
+ public static function toDatabase ($ value , array $ params = []);
52
+
53
+ /**
54
+ * Takes value from database, returns its value for the Entity property.
55
+ *
56
+ * @param bool|float|int|string|null $value Data
57
+ * @param array $params Additional param
58
+ *
59
+ * @return array|bool|float|int|object|string|null
60
+ */
61
+ public static function fromDatabase ($ value , array $ params = []);
38
62
}
0 commit comments