Continuing to list starter features, I have also integrated Ruby on Rails (RoR) style layouts and before / after filters.
Both were implemented as CI hooks - both the layout and filter code was obtained from the CodeIgniter forums and wiki posts
- Layouts: CodeIgniter Forums Post
- Filters: CodeIgniter Forums Post - Filters
Using the Filters hook, each action is wrapped in a Doctrine Transaction, which ensures all db updates etc. are ATOMIC.
One hassle I found with the above Filters system was that I couldn't implement a before / after filter directly in the controller class. Within the Doctrine_Transaction filter I ensure that if a controller has a before_action, or after_action function within its class definition, it is called before, or after the action is executed. This obviously could / should be abstracted out eventually into its own Filter class.... but it works just the same as is.
No comments:
Post a Comment