Я имею hasAndBelongsToMany
отношения, настроенные между моим Почта
модель и Признак
модель.
Я хочу beforeSave()
метод в моем Признак
модель, которая выполнит, когда признаки будут спасены.
Problem is, in my controller I'm calling $this->Post->save($this->request->data);
and it doesn't seem to fire the beforeSave()
method in the Tag
model, even though they have a relationship between them and tags do get saved along with the post.
Я мог поместить свою логику в модель beforeSave()
method of the Post
model, but then I would have tag related logic in my Post
, которая не кажется правильным.
Есть ли способ запустить модель beforeSave()
method in my Tag
, когда почта спасена?