Hi,
I'm having a set of related models in my project and want to override the save()-method of "\Phalcon\Mvc\Model" to implement some logging and exception handling, so I don't have to check for errors on every single save()-call.
To accomplish this, I created a "Basemodel"-class which extends "\Phalcon\Mvc\Model" and have all my models extend "Basemodel". In "Basemodel" I included a save()-class, which (for starters) only looks like this:
public function save($data = null, $whiteList = null)
{
parent::save($data = null, $whiteList = null);
}
This works when using it on models that are not related to other models but will fail on a model that's connected to other models (using a relation-table and a many-to-many-relation). The strange thing is that it works when I remove the save()-method in "Basemodel", so saving a model with relation does actually work, just not when using parent::save() - why would it make any difference to use an overwritten method that just calls "parent::save()"?
Any hint is appreciated. Kind regards, Dirk