Is there any way to trigger hooks while using ORM Query Builder?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prathyush Shetty
    Junior Member
    • Oct 2023
    • 22

    Is there any way to trigger hooks while using ORM Query Builder?

    When you follow any record, followEntity method creates a new record in the Subscription table. AfterSave hook of the subscription entity is triggered since createEntity method is being used.
    But when you unfollow the record, unfollowEntity method deletes the record from the Subscription table. None of the subscription hook methods like afterRemove or beforeRemove are triggered because unfollowEntity uses ORM delete query builder to delete the record instead of the removeEntity method.

    Is there any way to trigger hooks while using the ORM delete query builder?

    Like:
    1. beforeDelete or afterDelete methods in the hooks (these methods don't exist in the latest version, not sure if they did before)
    2. afterDeleteEntity in custom subscription controller or services.
  • yuri
    Member
    • Mar 2014
    • 8455

    #2
    Not possible. You can trigger hooks manually. But it's unlikely what you need.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...