File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,36 @@ public function __get(string $key)
48
48
return null ;
49
49
}
50
50
51
+ /**
52
+ * Complimentary property checker to __get()
53
+ *
54
+ * @param string $key The name of the requested property, i.e. table to check for relations
55
+ *
56
+ * @return bool Whether the entity property or table relation exists
57
+ */
58
+ public function __isset (string $ key ): bool
59
+ {
60
+ // First check the framework's version
61
+ if (parent ::__isset ($ key ))
62
+ {
63
+ return true ;
64
+ }
65
+
66
+ // Get the schema
67
+ $ schema = $ this ->_schema ();
68
+
69
+ // Convert the key to table format
70
+ $ tableName = plural (strtolower ($ key ));
71
+
72
+ // Check for a matching table
73
+ if (isset ($ schema ->tables ->$ tableName ))
74
+ {
75
+ return true ;
76
+ }
77
+
78
+ return false ;
79
+ }
80
+
51
81
/**
52
82
* Intercept undefined methods and check them against known relations
53
83
*
You can’t perform that action at this time.
0 commit comments