Closed plcosta closed 8 years ago
no bug
you actually have two rows
Can you provide a minimal sample that reproduces the error? I'm not seeing this happen here.
Graham, the problem isn't two results. It is the results each have columns and then a copy on the data as numeric properties.
@Garbee Please take a look at: https://gist.github.com/plcosta/d3586ed721b6022906a7
@GrahamCampbell like Garbee said, the problem isn't two results. It is the results each have columns and then a copy on the data as numeric properties. The problem is not directly in this query, but any response has duplicates columns (as numbers).
I'm using 5.2.4 release.
Can you reopen this issue?
Please open the issue on laravel since eloquent has nothing to do with lumen.
@GrahamCampbell it occurs with Lumen and Eloquent only. But with Laravel and Eloquent have no problem. I'll try there.
I tested now and the problem persists without Eloquent.
I'm unable to replicate the issue here. Perhaps there is something going on in your configuration causing this.
Without a vagrant box or docker container to run that replicates the issue, it appears nothing is wrong in the framework.
@Garbee Thanks! I'll test.
@Garbee @GrahamCampbell This problem occurs when I use two database connections. I created a config directory in my project and add the file config/database.php with two connections. When I remove that, works fine.
Finally the problem was solved.
When the database.php file is created, you need to add the fetch param, like this:
<?php
return [
'fetch' => PDO::FETCH_CLASS,
...
]
@plcosta The fetch parameter is already set to that by default. I would be surprised if that is the actual cause of the issue.
@Garbee Apparently, when you create the database.php file, the default file is overwritten. So, you need to copy the entire file. Please, make a test. Create a config directory in your project and add the file config/database.php without the fetch parameter.
I am also facing same issue. but thanks to @plcosta for his solution. Issue Resolved
@plcosta thanks alot brother! saved us a few hours of digging.
thanks bro @plcosta
Very helpful, thank you so much!
just use $rows = $pdo->fetchAll(\PDO::FETCH_ASSOC);
Hi there!
I am build a simple query using Eloquent. I have the following action in my controller:
This is the json result:
The problem is not directly in this query, but any response has duplicates columns (as numbers).
Any thoughts?