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

Proposed Component Name Zend_Context
Developer Notes
Proposers Peter Kovacs
Revision 0.1 - 29 January 2008: Started proposal process
0.2 - 24 Febuary 2008: Proposal ready for review
0.3 - 11 June 2008: Added type casting (wiki revision: 26)

Table of Contents

1. Overview

Zend_Context implements Dependency Injection.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • It will read XML or php context files.
  • It will not read ini files.
  • It will provide a static class for getting objects.
  • It will provide methods for creating components from code.
  • It will provide interface for reading variables from config files

4. Dependencies on Other Framework Components

  • Zend_Exception
  • Zend_Loader

5. Theory of Operation

Configure the objects and their relations/dependencies of an application's context in a simple way (php or xml files) and load them easily.
For dynamic component creation and loading there will be a small interface.

There is a more complex approach in:

6. Milestones / Tasks

  • Milestone 1: [DONE]Design
  • Milestone 2: [DONE]Use cases
  • Milestone 3: [DONE]Unit tests
  • Milestone 4: [DONE]Api doc
  • Milestone 5: [DONE]Proposal
  • Milestone 6: Work on design, use cases and unit tests from comments
  • Milestone 7: Documentation
  • Future: New ideas (import, inheritance, scope, validation)

7. Class Index

  • Zend_Context (static class)
  • Zend_Context_Exception
  • Zend_Context_Component
  • Zend_Context_Component_Interface
  • Zend_Context_Loader (factory class)
  • Zend_Context_Loader_Array
  • Zend_Context_Loader_Exception
  • Zend_Context_Loader_Xml
  • Zend_Context_Property

8. Use Cases

UC-01: XML context file for use cases (test.xml)
UC-02: php context file for use cases (test.php)
UC-03: Loading an xml file and getting an object
UC-04: Loading a php file and getting an object by class
UC-05: Loading context from an array or a Zend_Config object
UC-06: Using properties
UC-07: Using components

9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 30, 2008

    <p>You might want to review current proposals:
    <a class="external-link" href=""></a></p>

    <p>At a minimum I would strongly prefer DI to rely on using Zend_Config as input.</p>

    1. Jan 30, 2008

      <p>Oops, I didn't see that. Thanks for telling.<br />
      There are lots of DI implementations. Zend_Di is like PicoContainer's and Zend_Context is like Spring Framework's. I will complete the proposal and than watch, how Zend_Di's proposal will go (and use Zend_Context on my projects, as I do now)</p>

      <p>I updated Use Case #5 with a Zend_Config example. I didn't rely on just Zend_Config, because it can not understand attributes of xml nodes. I tend to like xmls for config/context definitions (maybe this comes from using Spring and Eclipse <ac:emoticon ac:name="smile" />)</p>

  2. May 13, 2008

    <p>Is this proposal ready for review? If so, please move it to the correct section and announce the move on the mailing list.<br />
    Also, there is a proposal that add attribute support to Zend_Config_Xml that is currently under consideration.</p>

    <p>Thanks.<br />

    1. Jun 12, 2008

      <p>Yes, it is <ac:emoticon ac:name="smile" />. I moved it to the ready for review section.<br />
      I wrote an email to the core list, but I'm not sure if it arrived.</p>

      <p>Zend_Config_Xml Attribute Support looks promising and if it is accepted, than I can consider moving onto it.</p>

  3. Sep 03, 2008

    <p>I see that, ZF 1.6 has attribute support now. Because of arrays in parameters:</p>
    <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
    <elem key="host"></elem>
    <elem key="port" type="int">1234</elem>
    <elem key="username">dbuser</elem>
    <elem key="password" value="secret"/>
    <elem key="dbname" value="db"/>
    <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
    <p>I will have to rethink the structure to rely fully (only) on Zend_Config.</p>

  4. Feb 07, 2011

    <p>Archiving this proposal, feel free to recover it when you want to work on it again. For more details see <a href="">this email</a>.</p>