You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 12, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: src/Automatorm/Exception/Model.php
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,10 @@ private function make_message($code, $data)
73
73
74
74
case'MODEL_DATA:UNEXPECTED_COLUMN_NAME':
75
75
list($model, $column, $value) = $data;
76
-
return'MODEL_DATA:UNEXPECTED_COLUMN_NAME: Property "'.$column.'" does not exist in the schema for this object ('.$model->table_name.'). Please check the $model for this object, or look at $obj->var_dump()';
76
+
if ($model['columns'][$column . '_id']) {
77
+
return'MODEL_DATA:UNEXPECTED_COLUMN_NAME: Property "'.$column.'" does not exist in the schema for this object ('.$model['table_name'].'), but "'.$column.'_id" does. You probably haven\'t set up the foreign key for this column!';
78
+
}
79
+
return'MODEL_DATA:UNEXPECTED_COLUMN_NAME: Property "'.$column.'" does not exist in the schema for this object ('.$model['table_name'].'). Please check the $model for this object, or look at $obj->var_dump()';
@@ -84,9 +87,12 @@ private function make_message($code, $data)
84
87
list($column, $value) = $data;
85
88
return'MODEL_DATA:CANNOT_CALL_MULTIPIVOT_AS_PROPERTY: Property "'.$column.'" represents a M-M (Pivot) relationship with more than two keys. As we don\'t know which type of object to return (as there are multiple choices), you can\'t call this link as a simple property. Use the $model->property([\$where]) syntax instead.';
86
89
87
-
case'MODEL_DATA:CANNOT_DELETE_UNCOMMITED_DATA';
90
+
case'MODEL_DATA:CANNOT_DELETE_UNCOMMITED_DATA':
88
91
return'MODEL_DATA:CANNOT_DELETE_UNCOMMITED_DATA: You cannot mark a Data object for deletion if it does not represent an existing row in the database.';
return'MODEL_DATA:INCORRECT_MODEL_FOR_RELATIONSHIP: Property "'.$column.'" expected a Model relating to table "'.$expected_table.'" but a Model for "'.$supplied_table.'" was given instead.';
0 commit comments