View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Config_Db
{zone-data}

{zone-data:proposer-list}
[Nick Daugherty|mailto:ndaugherty987@gmail.com]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 7 May 2010: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Config_Db is a component for loading Zend_Config objects that have been stored as key/value pairs in a database
{zone-data}

{zone-data:references}

{zone-data}

{zone-data:requirements}
* This component *will* extend Zend_Config
* This component *will* use a database table for loading Zend_Config objects
{zone-data}

{zone-data:dependencies}
* Zend_Config_Exception
* Zend_Config
* Zend_Db
{zone-data}

{zone-data:operation}
Zend_Config_Db will load a stored Zend_Config object from a database, using the standard Zend_Config workflow. The idea is to store configuration key/value pairs as rows in a database, the main benefit being that configurations of this type can be more easily accessed by multiple servers...such as in a cluster environment, where a change to an Ini or XML configuration file would need to be replicated across all machines using it. A matching Zend_Config_Writer_Db component will exist for updating configurations.

The component should be as flexible as possible, being able to load simple key/value pairs from the database, as well as being able to support environments such as 'production', 'staging', etc. The component will more or less do a SELECT * on the table, and format the rows into a Zend_Config object. Arrays in the Zend_Config object can be represented simply by using Ini 'dot seperator' conventions in key names, such as 'site.emails.admin' for the key column. The component then splits on the separator, breaking it down into the appropriate array.
{zone-data}

{zone-data:milestones}
* Milestone 1: [design notes will be published here|http://framework.zend.com/wiki/x/sg]
* Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
* Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
* Milestone 4: Unit tests exist, work, and are checked into SVN.
* Milestone 5: Initial documentation exists.
{zone-data}

{zone-data:class-list}
* Zend_Config_Db
{zone-data}

{zone-data:use-cases}
||Instantiating with a Zend_Db_Table object directly||

$config = new Zend_Config_Db($dbTable);

||Instantiating passing a table name and adapter as configuration options||
$config = new Zend_Config_Db(array('adapter' => $dbAdapter, 'table' => 'my_config_table_name'));
{zone-data}

{zone-data:skeletons}
{code}

class Zend_Config_Db {

}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>