Michael Yevdokimov wrote:
Hello Victor,Could you please explain what the Model should be or how it should be presented in ZF in your opinion? Example is simple: I would like to use the model the same way as I do it in Rails, i.e. putting all the database manipulations and data validation into it. Thank you very much in advance.
One cannot simply port Rails-ActiveRecord to PHP (there are certain features used that are not yet implemented in PHP, possibly will be in PHP6).
In *my* opinion, a model, indeed, should look like that of Rails. In LIMB-project ( http://limb-project.com ) they've recently have made a step towards making their model much like Rails' one. You may also take look at php-doctrine.
But the *original* question was about "a model in MVC". To me, it looks like a senseless set of words. In MVC you are free to use any kind of model. Zend_Db_* does *NOT* provide you with an ActiveRecord, nor does it provide a means for validation and object-relational mapping. It is *just* what it is: a DBAL, a query-object, a Table-gateway and a Row-gateway. You may use it your application, and your application is free to acquire MVC architecture or some other architecture as well.
Although there is sometimes a need for an advanced ORM in an application, the means provided by Zend_Db_*, should, as I believe, satisfy developer in 80-90% of cases. And, there is a strong doubt that a large-and-heavy ORM tool could really solve all the problems regarding application-RDBMS relation.
Regards, Victor.PS. The question you have asked (if before we refer to the original question), should not be "what the Model should be or how it should be presented in *ZF* in your opinion?" - but instead "what the Model should be or how it should be presented in *MVC* in your opinion?". I cannot answer this question, and think nobody can.
smime.p7s
Description: S/MIME Cryptographic Signature
