Does phalcon support attaching events to specific model before* or after* ? #16541
Replies: 3 comments 5 replies
-
You should be able to do that by using the methods in the model itself. Alternatively you can attach a listener with the before/after logic globally and have a simple |
Beta Was this translation helpful? Give feedback.
-
I know about those methods. But as I mentioned before: in some of the bigger models I see that afterSave is getting bigger and bigger and there is a lot of different logic there. It would be much cleaner If I could attach multiple external listeners ONLY to specific model afterSave method. Not to all of them. |
Beta Was this translation helpful? Give feedback.
-
OK, so in summary: there is no way to attach external listeners to a specific model hook. For example, there is no way to use |
Beta Was this translation helpful? Give feedback.
-
Hi,
I would like to attach external listener to specific model beforeSave and beforeUpdate hooks. Is it possible? I have tried putting FQN name into attach with beforeSave etc. but without any luck. I would like to avoid attaching it to all models - I have hundreds of them. If this is missing then it is a big omission IMHO.
Thanks and have a nice day.
Beta Was this translation helpful? Give feedback.
All reactions