Skip to content
Advertisement

Phalcon ORM – integer field id is string after save

I’m using Phalcon for my current project and i’m seeing some strange behaviour with the type casting.

I have this model

JavaScript

In my service, i save a new Customer model like this:

JavaScript

The problem i’m facing is that the id is a string, instead of an integer. In db the fiend of course is an auto increment int, primary key.

Also, I have already added those lines in my db connection

JavaScript

which only solves the problem when you fetch from database and not when you save.

I don’t want to use a getter for id, since I have implemented another functionality with magic setters/getters.

Any solution on this issue?

Advertisement

Answer

The correct issue for this problem is https://github.com/phalcon/cphalcon/issues/13002 and has been resolved now. Just use

JavaScript

in your bootstrapping to activate workaround globally

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement