Services are available via the module autoloader, so if you have modules initialized via the modules resource plugin you can do:
new ModuleA_Service_x Your services would be stored in: moduleA - services This is part of the resource autoloader, for dao you can add a custom resource type. You may also want to look at YADIF DI Container, its very good :) Thx Keith 2009/8/22 tomascejka <dis.cejkato...@gmail.com>: > > Hi, > > I am newbee and study ZF and I would like separate Model logic to another > tiers Service and Dao. Application assumptions that service and dao tier > will be shared and accessed from any module. Dao object is object extends > Zend_DB. Service will be my implementation. > > Application filesystem: > > |- application/ > | |- modules/ > | |- moduleA/(there is classic ZF structure: controller, > model, view) > | |- moduleB/(there is classic ZF structure: controller, > model, view) > |- service/ > |- dao/ > > The goals of this approach: > - Service object is just responsible to comunication with dao tier, dao does > not know about Service > - Model in concrete module will invoke service metods to get results from > db, service does not know about Model logic in modules > - Service will be my implementation (one ServiceConsumer object will be able > to invoke concrete service, > ServiceConsumer->getAllServicess()->getServiceModuleA().createPerson(Array > $personData)) > - Service can be shared, so model of moduleB can via ServiceConsumer invoke > serviceModuleA > - Dao object is Zend_Db object (dao extends Zend_DB), > - possibility to change Dao tier anytime (mysql, mssql, posgre etc.), > > My problem is : > > How to bootstrap this enviroment? > 1. if application bootstrap/run, each Model would be able to call > ServiceConsumer object and get required service, for example: > ServiceConsumer->getAllServicess()->getServiceModuleA().createPerson(Array > $personData) > > 2. ServiceConsumer must be invoked in bootstrap process ZF to set up Service > enviroment, I mean, ServiceConsumer has to find, set up every service object > (in service directory) and be able to invoke these service objects after > boostrap process from any Model from modules. > > I think about something this way: > - ServiceConsumer must iterate over service directory and every service > object set into within itself via setter metod to be able to provide > serviceModuleA to via getter. > > QUESTIONS > A. IS THERE POSSIBLE TO MAKE THIS APPROACH IN ZF? (I mean auto instancing > and preparing service enviroment in bootstrap process)? > B. IS THERE SOMETHING PROBLEM TO MAKE THIS APPROACH IN ZF? (I mean, ZF model > is not prepared, or is not allowed for this approach, or it is solved > another way... etc. ) > C. IS IT REASONABLE TO SEPARATE TO ANOTHER TIER? (maybe ZF already implement > this approach and I do not know)? > > > Thanks for your answers > > > ----- > Enviroment > ========== > > OS: > SUSE Linux Enterprice 10 (i586) - version 2.6.16.60-0.27-smp > Windows XP > > Tomcat v6.0.16 > Java(TM) SE Runtime Enviroment (build 1.6.0-b105) > Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode) > Maven v2.0.9 > Apache 2.2.11 > MySQL 5.1.30 > PHP 5.2.8 > qooxdoo-0.8.2 > Python 2.5 > > Hudson: > ======= > version 1.304 > plugins: Maven 1.304, SSH Slaves > running: deployed in Tomcat > > front-end developer web-based application > A.S.E.I. [http://www.asei.cz] > -- > View this message in context: > http://www.nabble.com/Another-multitier-approach-SERVICE-and-DAO-tp25092353p25092353.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- ---------------------------------------------------------------------- [MuTe] ----------------------------------------------------------------------