Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="info"><ac:parameter ac:name="title">New Proposal Template</ac:parameter><ac:rich-text-body>
<p>This page has been created from a template that uses "zones." To proceed:</p>

<li>Edit the page</li>
<li>Replace sample content within each zone-data tag</li>
<li>Remove this notice</li>
<li>Save the page</li>
<li>When you are ready for review, remove the <ac:emoticon ac:name="warning" /> Under Construction notice</li>

<ac:macro ac:name="note"><ac:parameter ac:name="title">Under Construction</ac:parameter><ac:rich-text-body>
<p>This proposal is under construction and is not ready for review.</p></ac:rich-text-body></ac:macro>

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Controller_Scaffold Component Proposal

Proposed Component Name Zend_Controller_Scaffold
Developer Notes
Proposers Jeremy Giberson
Revision 1.0 - 21 March 2007: Created proposal (wiki revision: 6)

Table of Contents

1. Overview

Zend_Controller_Scaffold aims to provide Scaffolding similar to ruby on rails by extending the Zend_Controller classes.

2. References

  • Google
  • real references to be added

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component provides Scaffolding through Controllers, one table per controller with List, Add, Remove and Edit actions.
  • This component will provide the features with out the need to create any files.
  • This component will provide fallback support--you can code parts of your controller and rely on Scaffolding for incomplete actions.
  • This component will use Zend_View for displaying output. View files will be for form fields (input) and controller files (layout).
  • This component will support overloading or changing the view directory to use custom views.
  • This component should optionally rely on Zend_Filter to provide form validation for data entry and updates.

4. Dependencies on Other Framework Components

  • Zend_Exception
  • Zend_Controller
  • Zend_Filter (maybe)
  • Zend_View

5. Theory of Operation

The componenent is utilized by instanciating a Zend_Controller_Front_Scaffold object. By default, Scaffold provides the exact same behaviour as Zend_Controller_Front. With a few meaningful method calls the developer can specify a controller name for the scaffold to provide scaffold features for. If no controller file exists scaffolding will dynamically instantiate Zend_Controller_Action_Scaffold to provide actions for the controller. If however an action controller exists it will be used instead, but for any undefined action the controller will fall over to Zend_Controller_Action_Scaffold.

The developer will be required to instantiate a Zend_Table object for each table/data they desire Scaffolding for. Zend_Controller_Front will be replaced by Zend_Controller_Front_Scaffold why by default exhibits the same behaviour. The developer will pass a controller name and zend_table object to the controller to enable scaffolding. Optionally the developer can enable scaffolding for many zend_table objects under different controller names and relate controls by a table and field thus providing a relation between scaffolding objects.
When a URI references a Scaffold'ed controller it will check the controller directory for an existing controller, should none exist Zend_Controller_Action_Scaffold will be used in its place. If however, a controller file is in place, it will be used for all defined Actions and only undefined actions will fall back to Zend_Controller_Action_Scaffold. This will allow the developer full scaffolding ability with no pre file generation and the ability to slowly replace scaffolding with actual code.

6. Milestones / Tasks

  • Milestone 1: General consensus this is a prefered implementation of Scaffolding
  • Milestone 2: design notes will be published here
  • Milestone 3: Working prototype checked into the incubator supporting use cases #1, #2, ...
  • Milestone 4: Working prototype checked into the incubator supporting use cases #3 and #4.
  • Milestone 5: Unit tests exist, work, and are checked into SVN.
  • Milestone 6: Initial documentation exists.

7. Class Index

  • Zend_Controller_Front_Scaffold
  • Zend_Controller_Action_Scaffold
  • Zend_Controller_Dispatcher_Scaffold

8. Use Cases


Scaffolding a (very) simple blog. The blog table contains a date, a title, an entry and a mood. Mood is a foreign key to a mood table populated with ascii mood descriptors [ :/ ;\ ].

The bootstrap file:

This short bit of code provides two scaffolded controllers:
Each of which provides the ability to view the rowsets in the related table, add, edit and delete rows into the table.
The following is psuedo html output resulting from this code.

03/16/07 - Lorem ipsum et sel adul..
(view | edit | delete)
:/ 03/14/07 - Tores pe et sodi carum...
(view | edit | delete)
:] 03/13/07 - Etchel postori et mi..
(view | edit | delete)

Blog (New Entry)
Date: <date select>
Mood: <list select> <a>view</a> (view scaffolding for MoodTable)
Title: <text input>
Entry: <textarea>
<submit> <cancel>

Blog (edit)
Date: 03/16/07
Mood: < > <a>view</a> (view scaffolding for MoodTable)
Title: Lorem ipsum et sel adulor pak
Entry: sodu pecicl nots ss..
<submit> <cancel>

Notice in this crude example, that the display area for Mood has a link (points to to the table it is related to. This is directly resulting from the scaffoldingRelate() method.

9. Class Skeletons



scaffold scaffold Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 20, 2010

    <p>Everyone should definitely take a look at live implementation of scaffolding here:<br />
    <a href=""></a></p>