Skip to content
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

QueryBuilder Result in Array format PDO::FETCH_ASSOC #79

Open
najicham opened this issue Dec 5, 2017 · 1 comment
Open

QueryBuilder Result in Array format PDO::FETCH_ASSOC #79

najicham opened this issue Dec 5, 2017 · 1 comment

Comments

@najicham
Copy link

najicham commented Dec 5, 2017

First, thank you so much for making this package, it is amazing!

It would be great to get query builder results as an associative array.

I see in vendor/illuminate/database/Connection.php:
line 102:
protected $fetchMode = PDO::FETCH_OBJ;

in file vendor/illuminate/database/Capsule/Manager.php:
line 47:
protected function setupDefaultConfiguration()
{
$this->container['config']['database.fetch'] = PDO::FETCH_OBJ;
$this->container['config']['database.default'] = 'default';
}

Is there currently an easy way to update the Illuminate container config? What do you recommend is the best way to set the database.fetch = PDO::FETCH_ASSOC?

thanks!

@wouterj
Copy link
Owner

wouterj commented Dec 5, 2017

I'm not entirely sure, but it seems like calling Manager::setFetchMode() should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants