View Source

<h4>Requirements</h4>
<ul>
<li>Create Zend\DB\Registry
<ul>
<li>Motivation: need a place for Driver connections, default and otherwise</li>
<li>Details: A registry would allow for named connections
<ul>
<li>Use case: read db and write db</li>
<li>Use case: marking a single connection as the default</li>
</ul>
</li>
</ul>
</li>
<li>Pluggable architecture
<ul>
<li>Motivation: there are plenty of feature requests that don't have a prope foundation for them to be implemented. Also, too many features that would currently require a BC break. Having a plugin system would reduce the likelyhood of feature requests that would require a BC break.</li>
<li>Details:
<ul>
<li>Ability to plug into Driver at various points
<ul>
<li>connection time</li>
<li>pre &amp; post execute time</li>
<li>pre &amp; post query time</li>
</ul>
</li>
<li>Ability to plug into Query creation
<ul>
<li>plug into any SelectPart creation (see query abstraction for parts)</li>
<li>plug into pre &amp; post assembly time</li>
</ul>
</li>
<li>For a common &quot;plugin&quot; interface, this shall make use of Zend\SignalSlot</li>
</ul>
</li>
</ul>
</li>
<li>Distinct abstractions
<ul>
<li>Motivation: Currently, the Adapter classes contain both the connection abstraction (PHP Extension) function calls as well as some of the Vendor specific query abstraction. This makes the adapters too rigid and too large to improve over time.</li>
<li>Details:
<ul>
<li>Driver abstraction
<ul>
<li>Ability to specify if direct query or parameritized query should be default</li>
<li>PHP Extension specific: pdo_*, mysqli, oci, sqlsrv, etc</li>
</ul>
</li>
<li>Query Abstraction
<ul>
<li>Insert, Update, Delete</li>
<li>Select: (column, from, where, group, having, order, limit, generic)</li>
<li>Vendor Specific Dialect: Mysql, Oracle, MSSQL, etc</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Addition of DDL query abstraction
<ul>
<li>Motivation: DDL queries have been requested time and time again. In addition, our unit testing suite requires the creation of tables, columns and other schema specfic assets to test against.</li>
<li>Details:
<ul>
<li>(This component will be used to build proper environment for testing)
<ul>
<li>Create, Alter, Drop, etc</li>
</ul>
</li>
<li>This will be part of the Query abstraction layer</li>
</ul>
</li>
</ul>
</li>
<li>Addition of a Metadata sub-component
<ul>
<li>Motivation: Currently, there is no formal way to encompass metadata in ZF. The adapter will provide describeTable() and Zend_Db_Table also does its own introspection over the schema. These types of lookups should be localized into a component that is capable of being both serialized and cached.</li>
<li>Details:
<ul>
<li>keep track of both introspected, and user provided schema information</li>
<li>these are cacheable objects</li>
<li>track relationships (FK constrains, Unique constraints)</li>
<li>track context of relationships (M2M, O2M, etc)</li>
</ul>
</li>
</ul>
</li>
<li>Separate Table &amp; Row Gateway into sub-components of their own
<ul>
<li>Motivation: Currently, both the adapter and Zend_Db_Table have an interface for insert(), update(), and delete(). Since these are Table Gateway specfic concerns, that is the only place this type of interface should exist. Furthermore, Zend_Db_Table can be seen as a heavy component since, by default, it creates an object (Row Object) out of each row returned in the result set. For some use cases (like data warehousing), it would be beneficial to be able to use Zend_Db_Table object that returns array's of information for performances's sake.</li>
<li>Details:
<ul>
<li>Table Gateway
<ul>
<li>Optional coupling with Row Gateway</li>
<li>Give table gateway the default option to return array of data</li>
<li>Will take advantage of the metadata component</li>
<li>Will also have a plugin system: pre &amp; post insert, update, delete time</li>
</ul>
</li>
<li>Row Gateway
<ul>
<li>Similar in nature to the current implementation</li>
<li>Will take advantage of the metadata component</li>
<li>Will also have a plugin system: pre &amp; post insert, update, delete time</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Better testability in the Unit Tests:
<ul>
<li>Motivation: Currently, the existing unit tests are slow, and hard to work with.</li>
<li>Details:
<ul>
<li>Better separation of concerns
<ul>
<li>With a strong abstraction of driver and query, there is no need for dependent components to test each flavor of DB</li>
<li>Tests should utilize a standard schema for each test, unless something specific is needed which will be created and destroyed at the end of the unit test.</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Base Plugins:
<ul>
<li>Type Converter:
<ul>
<li>Ability of a plugin to use metadata about a database, and user preferences to cast values from the database to desired primitive values and object types</li>
</ul>
</li>
</ul>
</li>
</ul>