Zend_Controller_Scaffolding will provide quick scaffolding features (that every mature framework has) by extending Zend_Controller_Action class. The component has a real code base (http://code.google.com/p/zendscaffolding/) and is used in several projects.
3. Component Requirements, Constraints, and Acceptance Criteria
This component provides typical scaffolding actions like CReate, Update and Delete, as well as data lists.
This component allows to easily mix scaffolding and custom actions.
This component allows to use custom views for scaffolding actions by setting a view path.
This component supports sorting of data lists.
This component supports partially (and will provide a larger support) data list filtering by one or more data fields.
This component supports pagination of data lists.
This component supports custom select statements (Zend_Db_Select or Zend_Db_Table_Select) for specific data lists.
This component provides several callbacks (through overriding of protected methods) to customize edit and search forms and enhance user experience.
This component supports data relationships (and will provide a larger support) when editing related entities (like one-to-many and many-to-many).
This component allows to restrict certain scaffolding actions and/or provide data listing only.
This component will support scaffolding configuration through Zend_Config.
4. Dependencies on Other Framework Components
Zend_Controller
Zend_Db
Zend_View
Zend_Form
Zend_Pagination
Zend_Validate
Zend_Filter
5. Theory of Operation
There are several steps:
Decide on data fields available for edition/listing/sorting/search and prepare two configuration structures: list of data (or synthetic) fields and general scaffolding options (like custom view folder, pagination etc.)
Initialize scaffolding by passing 3 parameters: data providing class instance and the two configuration structures.
6. Milestones / Tasks
Component has a stable release on Github.
7. Class Index
Zend_Controller_Scaffolding
8. Use Cases
Using scaffolding in a typical situation - back-end user management interface.
Suppose we have a (MySQL) table users with the following structure:
Also we created a model class Application_Model_Users that extends Zend_Db_Table. So, very basic scaffolding initialization will look like this:
Advanced usage with sorting, search, presentation tweaks, pagination.
List filtering (using Zend_Db_Table_Select). Useful for simple reporting.
Handling table relations (1-N, N-N).
Suppose we have two tables: Readers and Books. Each reader can read one or more books, and each book can be read by many readers.
Also, we want to handle this many-to-many relationship in this way: when registering a new reader we want to assign him immediately
one or more books. We need to do the following:
9. Class Skeletons
View scripts View scripts for corresponding actions will be available. User will have to place them under /views/scripts/scaffolding.