Skip to end of metadata
Go to start of metadata

Zend Framework: Zend_Context Component Proposal

Proposed Component Name Zend_Context
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Context
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: 25)

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: http://framework.zend.com/wiki/display/ZFPROP/Zend_Di+-+Dependency+Injection+Container

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

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

    You might want to review current proposals: http://framework.zend.com/wiki/display/ZFPROP/Zend_Di+-+Dependency+Injection+Container

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

    1. Jan 30, 2008

      Oops, I didn't see that. Thanks for telling.
      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)

      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 )

  2. May 13, 2008

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

    Thanks.
    ,Wil

    1. Jun 12, 2008

      Yes, it is . I moved it to the ready for review section.
      I wrote an email to the core list, but I'm not sure if it arrived.

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

  3. Sep 03, 2008

    I see that, ZF 1.6 has attribute support now. Because of arrays in parameters:

    I will have to rethink the structure to rely fully (only) on Zend_Config.

  4. Feb 07, 2011

    Archiving this proposal, feel free to recover it when you want to work on it again. For more details see this email.