Dec
11
2008
Most professional PHP developers should be familiar with phpDocumentor, an “auto-documentation tool for the php language”. If you’re not please go check it out and start using it immediately! It has some great features, but that’s not in the scope of this post…
Unfortunately most of the phpDocumentor templates leave much to be desired! However I’ve started looking around for some others and was quite impressed by these:
I’ll update this post as I find more, so please feel free to contribute..
3 comments | posted in PHP
Dec
5
2008
Don’t get me wrong ZF is my PHP framework of choice however it’s really lacking the Model concept from the MVC design pattern! The Model is where you should be implementing your business logic, data validation for example…
Zend Framework implements interfaces for filtering and validation on it’s Form components. The framework however lacks these interfaces on other components suitable to implement a true MVC design pattern where the validation would occur in the Model.
The interfaces on the Form component aren’t suitable for complex applications where a single model is used by multiple forms in the application. Say you store your email addresses in a single table in your database, but in your application, multiple ‘objects’ have email addresses associated with them… Should u have to setup the email address validation 10 times for each form the field is used in? I don’t think so…
I’m yet to work out the perfect solution to this unfortunately, but some ideas I’ve had are:
- Store you Form Elements in your model classes and add them to your forms in the Controller as required.
- Create you own model class with it’s own validation interfaces.
The second option is what I’ve done in past applications and I’m just about to start my next and decided to see if there is a better solution out there… The best article I’ve found was at techfounder and was proposing the second option as well and had some good examples. And model class approach on jmgtan.. However both still leave a lot to be desired :(
I’d be interested to hear any other ideas, or see any other bookmarks you have!
2 comments | tags: form, model, mvc, validation, Zend Framework | posted in Zend Framework