We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

After Model::create(), all fields in db saved as null, except id

I'm got some strange behavior after the model was saved. All fields are become the null, except id. After some debugging i'm found out the query.

It's like this: INSERT INTO "user"."user" ("externalid", "apprights", "apprightsrequested", "balance", "created", "accesstoken", "id") VALUES (null, null, null, null, null, null, default)

But why? All properties in the model are filled. Somebody can explain me why it happening and how to fix this?

PS: Sorry for my english...

hard to say without more closer investigation of your source code ... if you want join phalcons irc channel, easier for people there to go thru your source code and find problem



1.5k
Accepted
answer

I solved the problem. The problem is I'm usually use the camelcase style. And i trying to do this in phalcon model. But phalcon unlike my current framework, using name definition from table, not from model.

field name -> fieldname. property name -> propertyName.

So on save the phalcon trying to read non-existing $modle->fieldname.

The question is, why an error is not rised on try to read of not-existing propery?