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

Impossible to extends a Model ?

Hi.

I'd like to make a "baseModel" with some property like 'createdAt', 'id' and 'updatedAt'. But on function 'beforeValidationOnCreate' of my Users model, when i call the parent::beforeValidationOnCreate to update my date fields I got an error 'The method 'getCreatedAt' doesn't exist on model 'App\Models\Users'.

Is it even possible to do a baseModel ?

If not I'll change my baseModel to make a trait instead.



8.2k
Accepted
answer

Sorry I'm an idiot ... the getter/setter didn't work because I change the property name but not the function name ... >.> bad idea to code when exhausted, sorry.