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

\ORM\Model::find() always returns empty array when using db config type: mysqli and enable_cache:false #2104

Open
tatswata opened this issue Nov 1, 2018 · 0 comments

Comments

@tatswata
Copy link

tatswata commented Nov 1, 2018

hi

when I set db config to type: mysqli and enable_cache:false,
\ORM\Model::find() always returns empty array.

like this:
fuel/app/config/db.php

return [
    'default' => [
        'type'          => 'mysqli',
        'connection'    => [
            'hostname'      => 'xxxxxx',
            'database'      => 'xxxxxx',
            'username'      => 'xxxxxx',
            'password'      => 'xxxxxx',
        ],
        'charset'       => 'utf8',
        'enable_cache'  => false,
    ]
];
<?php
class MyModel extends Orm\Model
{
    public static function get_instance()
    {
            $results = static::find('all', []);
            var_dump($results);exit;
     }
}

// array(0) {
// }

it works correctly when I set enable_cache to true.

maybe...
I think the cause of this problem is that second args of mysqli::query() is MYSQLI_USE_RESULT and any fetching method is not called (like mysqli_fetch_row()).

https://github.com/fuel/core/blob/1.8/master/classes/database/mysqli/connection.php#L283

using version:

fuel/core                          1.8.1              FuelPHP 1.x Core
fuel/oil                           1.8.1              FuelPHP 1.x Oil Package
fuel/orm                           1.8.1              FuelPHP 1.x ORM Package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant