Why is it better to use event subscribers rather than hooks

by Kevin howbrook   Last Updated November 27, 2017 01:07 AM

In drupal 8, we now have the ability to use event subscribers. What's the reason for this? Is it to work with the new cache API better?

Recently I had a task of needing to extract data from a node when it was viewed, but hook_node_view() is cached (like nearly everything) in Drupal 8. So I ended up using an event subscriber. Why is using event subscribers a better solution? Is it just that it's more object orientated?

Related Questions

Caching Event Subcriber

Updated March 13, 2016 08:03 AM

How can an event subscriber have access to entity type?

Updated November 17, 2017 23:07 PM

Event Subscriber Drupal8

Updated January 11, 2019 06:07 AM