[Updated with follow-up video]
About a month ago I posted some ideas about PHP modeling in the Zend Framework and requested feedback. After a month of on-and-off discussions through this website and #zftalk I decided to sit down and implement things a little more.
I now have some working base classes that can be found on GitHub. Right now I’m still thinking things out, so there’s no guarantee that’s the structure I’m going to finish with, but it’s what I’m playing with right now. So far I’ve dropped the DAO interface and the Galahad_Service parent class all together (since both are going to be pretty unique to your application). What’s left is mostly the Entity class and the DataMapper class (as well as a very generic Collection class).
I’ve also started to write some tooling for my modeling system, based on Zend_Tool. Right now it’s generating the model itself, a DAO based on Zend_Db_Table and a Zend_Form (see Matthew Weier O’Phinney’s post about using forms in your models for my reasoning there). It doesn’t generate the DataMapper yet, but that’s just a matter of writing the code…
Again, I’d love some feedback on the direction this is going. Check out the video below and then let me know. Comment below, email me at *****@cmorrell.com or get in touch on Twitter: @inxilpro.
[View full size, or watch below]
Follow-up Video (demo of a lot more code):
Related posts:
- PHP Modeling (in Zend Framework) I’ve been thinking a lot about Modeling in a MVC...
- HTML5 Demo & Resources On April 27th I spoke at PANMA’s HTML5 Demystified event,...
- Video Platform Roundup (follow up) This post is a follow-up to my previous post about...
- Video Platform Roundup We’ve been evaluating a number of online video platforms at...
Regarding db tables I’d use Default_Model_Db_Table_User i.e. “Db_Table_User” instead of DbTable_User this will match ZF conventions.
Slavi
Actually, if you look at the existing autoloader code, the ZF convention is to use DbTable, not Db_Table.
Pingback: "Namespacing ACL resources & Galahad_Acl" by Chris Morrell
Pingback: "Namespacing ACL resources & Galahad_Acl" by Chris Morrell