File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1009,12 +1009,13 @@ function getColumnType($column) {
1009
1009
* Returns true if the supplied field exists in the model's database table.
1010
1010
*
1011
1011
* @param mixed $name Name of field to look for, or an array of names
1012
+ * @param boolean $checkVirtual checks if the field is declared as virtual
1012
1013
* @return mixed If $name is a string, returns a boolean indicating whether the field exists.
1013
1014
* If $name is an array of field names, returns the first field that exists,
1014
1015
* or false if none exist.
1015
1016
* @access public
1016
1017
*/
1017
- function hasField ($ name ) {
1018
+ function hasField ($ name, $ checkVirtual = false ) {
1018
1019
if (is_array ($ name )) {
1019
1020
foreach ($ name as $ n ) {
1020
1021
if ($ this ->hasField ($ n )) {
@@ -1024,6 +1025,12 @@ function hasField($name) {
1024
1025
return false ;
1025
1026
}
1026
1027
1028
+ if ($ checkVirtual && !empty ($ this ->virtualFields )) {
1029
+ if (array_key_exists ($ name ,$ this ->virtualFields )) {
1030
+ return true ;
1031
+ }
1032
+ }
1033
+
1027
1034
if (empty ($ this ->_schema )) {
1028
1035
$ this ->schema ();
1029
1036
}
You can’t perform that action at this time.
0 commit comments