Added by Mike Borozdin, last edited by Darby Felton on Nov 07, 2006  (view change)

Labels

 
(None)

Zend Framework: Intercepting Filters Component Proposal

Proposed Component Name Intercepting Filters
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Intercepting Filters
Proposers Mike Borozdin, author
Darby Felton, Zend liaison
Revision 1.1 - 18 July 2006: Some thoughts of mine. (wiki revision: 13)

Table of Contents

1. Overview

Zend Framework lacks of intercepting filters that should be executed before a specified controllers or actions in order to make some validations, for example, check whether user is authenticated if not then redirect to a login page, the code can look something like this

For instance, we have PagesController that has four actions: viewAction(), addAction(), editAction(), removeAction(), the last three actions can be performed by autenticates users only, so we must check. Sure, we can put this logic to the action method or write Authenticated_Controller_Action, but what if we have to make some other validations.

Zend Framework has a plugin mechanism that is not documented now, I tried to make a plugin that extends Zend_Controller_Plugin_Abstract but it lacks of interaction with controllers and action, besides it can't stop the routing process.

If you have any ideas, please comment or e-mail me.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

zone: Missing {zone-data:requirements}

4. Dependencies on Other Framework Components

zone: Missing {zone-data:dependencies}

5. Theory of Operation

zone: Missing {zone-data:operation}

6. Milestones / Tasks

zone: Missing {zone-data:milestones}

7. Class Index

zone: Missing {zone-data:class-list}

8. Use Cases

zone: Missing {zone-data:use-cases}

9. Class Skeletons

zone: Missing {zone-data:skeletons}

I found a solution http://www.sitepoint.com/forums/showthread.php?t=404478, just need to test it.

Zend Comments

The functionality implied by the described use cases is supported through the use of controller plugins.