We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Model hooks for "read" queries?

Developer Preview

Brian Litzinger's avatar
Brian Litzinger
693 posts
8 years ago
Brian Litzinger's avatar Brian Litzinger

Most core models have before/after delete/save events, but there are no events for when the model is fetching data. My use case was modifying the categories displayed on the Publish page when viewing a draft or translated entry. I was able to work around it (pretty smoothly actually) by using the custom_field_modify_data hook. Wondering if its viable to add event hooks like after_category_read/fetch/get?

       
Derek Jones's avatar
Derek Jones
7,561 posts
8 years ago
Derek Jones's avatar Derek Jones

I know we have some pretty significant concerns about performance and application stability with attaching events to read queries, but thanks for sharing the use case. We’ll chat and see what the best way is to accommodate this type of thing, which does seem useful for the publish page.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
8 years ago
Brian Litzinger's avatar Brian Litzinger

Yeah I can see how performance might be an issue, but using the custom_field_modify_data hook was a totally viable and fairly easy work around. I use the REQ constant to make sure I’m only doing that in the CP so the front-end performance isn’t affected as much.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
8 years ago
Kevin Cupp's avatar Kevin Cupp

We’re thinking we’re going to hold off on these read hooks for now. As Derek said, we’re a little worried about performance and other unintended side effects. We try to be fairly cautious and deliberate about adding hooks. If a particular hook is the only way to solve a legit problem, we usually add them, but since these don’t seem to be needed just yet, think we’ll hold off for now and see what can be done with existing extensibility. But thanks for bringing it up!

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
8 years ago
Brian Litzinger's avatar Brian Litzinger

Not a problem at all. Thanks for the update.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.