Announcement

Collapse
No announcement yet.

Trigger update on entity when adding a related entity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trigger update on entity when adding a related entity

    Hey guys,

    I have a product entity that can have multiple categories (which are set as related entities).
    Anyone know how can I set an updated flag on the product every time I link a new category?

    Thanks

  • #2
    Hi,

    You need to create a hook (see developer docs) for a product entity type and check whether category is changed.

    $entity->isAttributeChanged('categoryId').

    Comment

    Working...
    X