On Saturday 01 October 2011 01:16:34 robert mena wrote:
> Hi,
> 
> I've created my models using zend_tool so they were created with
> MyNamespace_Model_Something under application/models.
> 
> I am going to use Doctrine for db related operations and the service
> approach in order to have thin controllers.
> 
> My controllers are going to be under controllers - ok
> Doctrine, Zend files under library - ok
> 
> Where should I put the MyNamespace_Someting_Service and the Doctrine
> generated ones?
> 
> Regards.

I use only modules to build ZF apps, but you can easily change the setup to 
have your models in a non-module zf application.

For example, I want a Blog module with an Article model and an Article service 
to fetch all articles etc. First I create a modules/blog/configs/schema.yml 
with the yaml scheme for my models (articles, reactions, categories etc).

Then I use Doctrine_Code::generateModelsFromYaml() where I provide the 
path to the yaml file, the path to my models directory and some options.
1) Models directory is modules/blog/models
2) Options are at least baseClassPrefix "Base_", classPrefix "Blog_Model_" and 
pearStyle set to true

This results in an article model called Blog_Model_Article, located in 
modules/blog/model/Article.php and it's extending the 
Blog_Model_Base_Article which is located in 
modules/blog/model/Base/Article.php

Next, service classes are mapped by ZF when you place a Blog_Service_Article 
class in modules/blog/services/Article.php

It's easy to change the setup and remove the module part and instead use your 
application namespace (eg Application_). If you have more questions, tell me 
:)

Regards, Jurian

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to