Joshua is stopping development of Nexista, and recommended Symfony Project. I'm also familiar with Phing, Creole, and Propel, so here are some of my thoughts about all this.

Goals

  • Retain existing code, and continue using XML for configuration and queries and XSLT for presentation.
  • Start to use data object persistence to leverage CRUD efficiencies. (Create, retrieve, update, and delete)
  • Improve schema format. So far, I am impressed with Propel's schema definition. It looks pretty close to metabase's schema format, and adds relationship metadata (required for persistent objects).
  • Change and improve sitemap format, creation, and processing. Things get complicated when you have multiple pages in one gate, or use the regex match to define gate includes. It would be so awesome to use the software interface to build, edit, and write sitemaps. In development mode, it makes sense to have a control panel of sorts for some pages so that you can override some of the sitemap settings, and build them into the "main" sitemap that is including the others.

Problems

  • Symfony uses YAML instead of XML for configuration and PHP instead of XSLT for presentation. Turns out Symfony will support XML configuration files, as well as ini files to boot.
  • Propel uses Creole instead of PDO.
  • The problem with propel and doctrine which create php classes and objects based upon your data model is that it is not agile at all. You can build-and-use, as in extreme programming. The best type of programming in my humble opinion is when you are doing usability tests as you go, better yet, where your use of the software drives its manifestation and behavior!

It appears that a switch from Metabase to Creole would not be far fetched, and would create a bridge to Propel for data object persistence.

Ideas

  • Nexista MVC (model, view, controller) capabilities could be expanded upon with additional XML transformations, taking the efficiencies of data object persistence even further.
  • An XML file for each of the MVC components: xml schema, xsl templates, and xml queries?
  • There are probably some pieces of phing / propel which can help you achieve what you are trying to in the above item.

Questions

  • What is the value of a database abstraction layer abstraction layer? There is only a need because there are so many database abstraction layers in php. With Nexista's sqldatasource, it wouldn't be too difficult.
  • Is PDO better than Creole? I ran some elementary tests with Nexista using both creole and pdo and was surprised to see creole faster by about 0.02 seconds. Metabase and creole were almost exactly the same speed, with variations of which one was faster.
  • Can Phing provide the connection between Creole schemas, CRUD, and MVC? It sits well in my mind that with a rich xml schema and a sitemap, you could create xslt templates AND xml queries for your data objects with Phing.
  • Write a data model, and auto-generate queries for controllers, auto-generate templates for viewing.
  • With a data model, you would then have a "tailored" phpmyadmin typ of interface, specific to your data model. You could then refine the interface and controllers using the actual interface. Then at the end you would use CSS2 to adapt the look and feel of the view.
  • What is the best way for using CSS2 with XSLT?
  • Return to the original concept of being able to port an application from PHP to Java with only a little work? Attempt to make Nexista equal Cocoon, and Creole/Propel equal JDBC/Turbine?
  • Would it be possible to create actions and view via XSLT and Phing?

References


Database thoughts:

There is a lot happening in PHP 5 with regards to databases. First off, PDO - PDO is a native PHP API for database abstraction. Since its written in C, it should be faster. However, it doesn't support all databases, and I've read some doubts about its future. Thought investigating this last point turns up some interesting points:

http://www.sitepoint.com/forums/showthread.php?t=171535 http://www.zend.com/zend/week/week223.php#Heading5

Besides PDO, talk about choice! Here's what's out there:

  • Creole
  • ADOdb
  • Metabase
  • MDB
  • MDB2 - may have support for foreign key constraints in the future
  • Pear DB

And that's an incomplete list!

I have used Metabase successfully for years, and I'm thinking of switching to Creole. As I evaluate this change, I want to make sure I shouldn't actually be switching to something else. Therefore, I'm also looking at MDB2, which if you read that zend.com link referenced above, you will see that Lukas Smith is planning on supporting MDB2 PDO support. Interesting. Not sure how that would work to have a db abstration layer on top of a db api, but I guess it would make switching from non-pdo to pdo much easier.

The objective here would be to convert to a new database abstraction layer with as little effort as possible. Currently we use Nexista so there is a bridge between our XML queries which leverage Nexista's flow and Metabase. That file is called sqldatasource.php. I will probably rename it metabase_connector.php, and then modify it as mdb2_connector.php, or creole_connector.php. That would be cool as I could then make a simple switch to test out various database abstraction layers, and their respective speeds. Joshua Savage, the author of Nexista, also created a Nexista class for connecting directly to pdo, called ndo. I have yet to evaluate this, but like the rest of Nexista and Joshua's work, I'm sure its high quality.

Even though I have ADD, I'll try to review my experiences with these ONE at a TIME!

Creole Back in the day I worked on Phing (a PHP port of Apache's Ant). Back then I didn't really know what I was doing but Andreas Aderhold was patient enough to teach me enough so that I could help. When I changed focus to Nexista and stopped contributing to Phing, Hans Lellelid came along and pretty much rewrote the entire package (with others help too!). They also came up with Creole and Propel. When I finally took a moment to revisit Phing recently, I was very impressed, and I hope to be similarly impressed with Creole.

Installing Creole Like Phing, Creole has its own Pear channel, so installation is a breeze:

pear install http://creole.phpdb.org/pear/creole-current.tgz
The Creole documentation instructions jump right to using the creole api directly, but since I am going to try and modify the sqldatasource.php file to connect to creole, I have to take a different route.

  • With APC enabled, PHP throws a segmentation fault.
  • For changing from metabase to creole, must change function calls from prepareQuery to prepateStatement. There are several instances like this. They use different type casting functions, and there is no freeResult or getColumnNames in creole.
  • There are also auto_increment differences. Creole has a clever native auto_increment solution that seems perfectly fine - Hans even warns people about portability in the docs! Nice. I'm confused about how to actually use the sequence name reference, as I don't have a database that natively supports sequences, and I haven't yet tried getting the id after the query is executed.

To further explore creole, I will install propel. It has a function to reverse engineer databases from sql to the xml schema format, similar to the function in Metabase. To do this, I plan to STOP USING THE PRODUCTION DATABASE, and instead setup a development database. In that case, if I break something, it won't be a big problem.

Nexista note: two files are involved in this process: sqldatasource.php and query.action.php. The action chooses the datasource file by prepending "datasource.php" with the type, so if it is a sql data source, the file that is loaded is sqldatasource.php. In that case, it makes sense to use creole_sqldatasource.php, pdo_sqldatasource.php, and metabasesqldatasource.php.

**Related Links: http://www.codecomments.com/archive216-2004-10-270757.html