Tom Graham-2 wrote:
> 
> Hi Matthew,
> 
> After reading your slides from DPC a while ago I've been looking into the
> service layer pattern and have done al ittle refactoring in a project I'm
> working on. One thing I have been wondering is do you ever access your
> mapper directly within a controller (i.e. editing a record and just
> needing
> to fetch by ID) or do you have all required methods within the service?
> 

That is exactly the same question i have now :)

So thats how i did it now. 

I created a Mapper for the webservice which is able to handle all requests
from webservices and also could save the requests into a database. Then i
created a service layer which is filtering and validating the query/results.
So i abstracted the functionality needed for the applicatoin into the
service layer right as the data mappern should only read and write data and
map it with the data access objects. 

Please correct me when i misunderstood anything.

So the whole functionality is being provided by utilizing the service layer
but how do you access the decorators, mentioned in your slides? 

something like this maybe?

class Default_Model_Service
{

    public function fetchAll($decorator)
    {
        $decoratorMethod = ucfirst($decorator) . 'Mapper';
        $decorator = new $decorator($this->getMapper());
        $decorator->fetchAll();
    }
}

$service = new Default_Model_Service();
$service->fetchAll('Caching');
-- 
View this message in context: 
http://www.nabble.com/Zend-Model-with-Webservices-%28Soap-Rest%29-tp24689665p24696811.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to