php - Phalcon Slayer is returning "0" for model id after create/save

one text

I am using Phalcon Slayer framework for my project, but when I'm trying to create/save a model instance to the database, I encounter an issue that id field always return "0" in my model

$customer = new Customer();
$customer->name = "John";
$customer->age = 18;
$customer->create();
dd($customer->id); // return "0"

Data is saved successfully in database, the id field has correct (auto increment) data.

If I try with raw Phalcon, it works correctly (return correct id)

I found some solution that set 'persistent' => true in database config. And it return id correctly.

'mysql' => [
    'host'     => env('DB_HOST', 'localhost'),
    'port'     => env('DB_PORT', 3306),
    'username' => env('DB_USERNAME'),
    'password' => env('DB_PASSWORD'),
    'dbname'   => env('DB_DATABASE', 'slayer'),
    'persistent' => true,
    'charset'  => env('DB_CHARSET', 'utf8'),
    'class'    => Phalcon\Db\Adapter\Pdo\Mysql::class,
],

But I am not sure this solution is the correct approach. Can anyone help show me what is wrong here and what should I do?

FYI:

  • PHP 7.2 (I also try with 7.0 and 5.6)
  • Phalcon 3.4
  • MySQL 8.0 (I also try with 5.4)

Source