[consulting] CiviCRM / Zend Framework / DBTNG

Michael Prasuhn mike at mikeyp.net
Fri May 7 16:56:26 UTC 2010


Well, what the database layer in Drupal 7 does and doesn't do is a little blurry sometimes. For the most part it functions as primarily a query builder and abstraction layer (now supporting 5 databases!*). It is not however, an ORM. In that sense DBTNG isn't really suited for any type of data structure over any other type. Drupal 7 is focusing some of the functionality of an ORM at the entity level, with it's Field API. At this point, the line between easily removed library and tightly coupled code is crossed, and that functionality isn't possible without moving most of the functionality into Drupal.

Could a simple ORM be built on top of DBTNG? I don't see why not, but at that point it's not really a 'Drupal like API' anymore, and you'd be back to where you started, although the ORM code would look more familiar to Drupal developers.

-Mike

*MySQL, PostgreSQL, SQLite, Oracle, and MS SQL Server
__________________
Michael Prasuhn
mike at mikeyp.net
http://mikeyp.net

On May 7, 2010, at 6:12 AM, Joe Murray wrote:

> I'm trying to get my head around architectural options for CiviCRM 4.0 that might allow one to more easily leverage of 'Drupal as a developer framework' as opposed to 'Drupal as user CMS'. This would IMHO meet a CiviCRM goal of increasing its developer community.
> 
> I just want to talk about the database layer right now to keep things focussed. One of the frameworks being consider as a replacement for the PEAR library (DBDataObject and HTML Quickform in particular) is the Zend Framework. It uses PDO libraries. DBTNG for Drupal 7, as I understand it, also sits on top of PDO. I find Mike Prasuhn's information about the modularity of the Drupal 7 db layer to be very interesting. For those who don't know, CiviCRM currently uses a fairly traditional tiered architecture, and generates its data layer code from an XML representation of its data schema for the most part (some business layer logic bypasses the Data Application Object (DAO) layer by reading directly from the MySQL tables for optimization purposes, for example). I imagine that the DBTNG layer is focussed on supporting Drupal data structures, but I believe it has some support for creating access to arbitrary non-Drupal data stores as well, which CiviCRM might qualify as.
> 
> Is it remotely feasible to think of using DBTNG as the primary database layer for CiviCRM 4.0? What is the overhead of using for non-Drupal sites? Or is it better to imagine setting up access to the couple hundred tables in CiviCRM via DBTNG's external datasource structure, and then using that as a good way to integrate with fields, views and that good stuff?
> 
> Just trying to explore whether there is some common ground here.
> 
> Joe Murray, PhD
> President, JMA Consulting
> joe.murray at jmaconsulting.biz
> skype JosephPMurray twitter JoeMurray
> 416.466.1281



More information about the consulting mailing list