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

save() fails silently when using relation

Hi

We have one model, with a hasOne relation defined,

call model one

call relation model var as such $varName = $modelOne->Relation->getVar();

then call a update to model one $modelOne->setAnotherVar('somevalue'); $modelOne->update()

this then fails to siliently, however removing the hasOne relation in this way and then calling a simplar process like so does work.

$Relation = Relation::findFirst("id = '{$modelOne->getRelationId()}'"); $varName = $Relation->getVar();

$modelOne->setAnotherVar('somevalue'); $modelOne->update()

Hi,

can you please paste your code? And use markdown to highlight syntax please (https://forum.phalcon.io/help/markdown).

In case if phalcon doing some wird thinks with database, it is good idea logging sql statements: https://docs.phalcon.io/en/latest/reference/db.html#logging-sql-statements