-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined property: stdClass::$column_name when generating a model #20190
Comments
Also encountered this in Laravel 5.4.28. Environment is PHP 7 and MySQL 8.0 using Laradock. The fix suggested above by @metaodi worked. Changed the query found in select column_name from information_schema.columns ... ...to... select column_name as `column_name` from information_schema.columns ... |
@Hyubs Thanks! It works! PHP 7.0.21, MySQL 8.0.1-dmr |
Is there a solution to this problem that doesn't involve patching something in |
@metaodi feel free to open a PR |
Opened a PR #21037 |
In the meantime if someone wants to automate patching this in
I've put this as a post-update-cmd hook in composer.json to apply it automatically. |
* catch errors as well (laravel#21047) * return from Validator::setCustomMessages (laravel#21046) * show exception class in JSON (laravel#21043) * [5.5] Removed listener listensFor (laravel#21039) * remove listensFor * remove listensFor * Specify lower case `column_name` (fixes laravel#20190) (laravel#21037) * [5.5] Add policies method to Gate (laravel#21036)
Querying information_schema.columns returns upper cased column names on some versions of mysqld. This is similar to an old bug in laravel/framework. See laravel/framework#20190 Fix by changing select column_name, column_type ... to select column_name as column_name, column_type as column_type ...
Totally works! Thanks" |
Description:
The
MySqlProcessor
assumes that the result from MySQL contains a lowercase column calledcolumn_name
.On my installation, if I run the query from
compileColumnListing
of MySqlGrammarThe result contains the column
COLUMN_NAME
in uppercase.I don't really know where this is changed. In the driver? Maybe it makes sense to change the query in
MySqlGrammar
to ensure the correct case of the result:Steps To Reproduce:
If I try to create a new model using the builder-plugin for OctoberCMS, I get the following error:
There is already an issue in that repo: rainlab/builder-plugin#161
The text was updated successfully, but these errors were encountered: