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
Error when using number as a table column name - ErrorException in VarCloner.php line 74 #8710
Comments
One SO question doesn't mean "most applications" use numeric column names. |
@lukasgeiter please I don't understand |
I highly doubt that as you say "most applications" have numeric column names. Besides that I'd also consider this quite bad practice since it's almost impossible that a numeric value is a descriptive name for table column. |
I totally agree with you about this being a bad practice however according to this question http://stackoverflow.com/questions/30162545/hide-number-field-from-eloquent-model-in-laravel/30162980#30162980, the developer also mentioned and I quote "I have field names in my model that are numbers (I don't have control over it's names)".. which means he cannot change it |
Sure that still doesn't mean that this is a common use case. Don't get me wrong, I don't think we shouldn't fix this, but it has rather low priority in my eyes. |
Yes sure. I don't think I will ever use number as column but for the sake of future I think it should be addressed. |
The error and "fix" you posted here in the issue have nothing to do with the framework itself. It's a problem in the Symfony VarDumper. However things don't really work in Eloquent as well. For example Unfortunately I believe this is just to PHPs type handling and can't be fixed easily... |
This's my first time of opening an issue here. Actually thought it could be fixed within a short time. |
We're open to PRs. |
@GrahamCampbell Please I don't understand your reply "We're open to PRs." ? |
It means if you want to fix it, feel free. Even a partial fix as a PR might allow someone else to finish up. |
@GrahamCampbell what worked for me was a Hack, which am sure is not good enough. Presently this is not possible in Laravel as seen in this line of code located in vendor\symfony\var-dumper\Symfony\Component\VarDumper\Cloner\VarCloner.php at line 74.
Here is the hack.
|
Its presently not possible to use MYSQL Database tables with numeric column names.
Most applications requires numeric table column names as you can see in the case of this stackoverflow question http://stackoverflow.com/questions/30162545/hide-number-field-from-eloquent-model-in-laravel/30162980#30162980
In attempt to answer the question above I added a column named '23' in a certain table which resulted in the error below:
I noticed that replacing this code in VarCloner.php line 74
with
resolves the issue, however this is a hack.
Please can the framework be updated to make using numeric table column names possible.
NB: Am using MySQL Database
The text was updated successfully, but these errors were encountered: