Skip to end of metadata
Go to start of metadata

<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_Scaffolding Component Proposal

Proposed Component Name Zend_Controller_Scaffolding
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Controller_Scaffolding
Proposers Alex Oroshchuk
Zend Liaison TBD
Revision 1.0 - Aug 2010: Initial Draft. (wiki revision: 20)

Table of Contents

1. Overview

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 (https://github.com/lex0r/zendscaffolding) and is used in several projects.

2. References

Guthub Project: https://github.com/lex0r/zendscaffolding

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

9. Class Skeletons

View scripts
View scripts for corresponding actions will be available. User will have to place them under /views/scripts/scaffolding.

]]></ac:plain-text-body></ac:macro>

]]></ac:plain-text-body></ac:macro>

Labels:
scaffolding scaffolding Delete
crud crud Delete
rad rad Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 21, 2010

    <p>Do you have open repository (Google code, Github ...) with work prototype?</p>

    1. Aug 27, 2010

      <p><strong>edited</strong><br />
      Yes (see the references)</p>

  2. Sep 04, 2010

    <p>Fix UC-4 "// Controller setup" section: what to do with array $fields?</p>

    1. Sep 08, 2010

      <p>just skipped details already described in UC-1. anyway updated the doc to make it more clear</p>

  3. Sep 07, 2010

    <p>Request for 2 things:<br />
    1. Add second submit button in update view which will save data and not change view. For example, it is useful when editor edit big article.<br />
    2. Add opportunity for some optional including of partial view. For example, for adding javascript check to specified fields. It can be done with optional options in the last parameter of initScaffolding.</p>

    1. Sep 08, 2010

      <p>1. Yes, that's a good idea. We can even have three buttons there:</p>
      <table><tbody>
      <tr>
      <th><p>Save</p></th>
      <th><p>Save and continue</p></th>
      <th><p>Save and create new</p></th>
      </tr>
      </tbody></table>

      <p>2. If you want a Javascript to be included why not include it with </p>
      <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
      $this->view->headScript()>appendFile($this>view->baseUrl('/js/some-script.js'));
      ]]></ac:plain-text-body></ac:macro>
      <p>by placing it in the desired action and calling the default scaffolding action:</p>
      <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
      public function indexAction() {
      $this->view->headScript()>appendFile($this>view->baseUrl('/js/some-script.js'));
      parent::indexAction();
      }
      ]]></ac:plain-text-body></ac:macro>

      <p>Do not forget we extend the scaffolding class, and many things become possible. </p>

    2. Sep 08, 2010

      <p>New buttons added</p>

  4. Jun 22, 2011

    <p>Small fix:</p>

    <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
    $options = array(
    // (...)
    // disable deletion action
    // 'disabled_actions' => array(self::ACTION_DELETE)
    )
    ]]></ac:plain-text-body></ac:macro>
    <p>Should be</p>

    <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
    $options = array(
    // (...)
    // disable deletion action
    // 'disabledActions' => array(self::ACTION_DELETE)
    );
    ]]></ac:plain-text-body></ac:macro>
    <p>If you want to disable actions.</p>

  5. Feb 02, 2012

    <p>Hi Alex,</p>

    <p>first of all, congratulations for such a great work. </p>

    <p>I would like to know if the scaffolding component you developed has image/file support in the forms update/create ? </p>

    <p>Thanks !!</p>