Question

I have started using the Yii framework and am really enjoying the way they do things. Though 1 thing I don't entirely agree with is the all the logic to do with interacting with the database is told to be put into the models. "Skinny controllers, Fat models".

I work in .NET MVC3 at work and though I don't mind putting model specific methods in my models, I believe that abstracting the DB logic into an entirely different service layer makes much more sense to me.

Can anyone throw me ideas on the best way to set this up? I'm thinking something like a class "BaseService" which inherits from Component and each SL object inheriting from that. Would this be a good way to do it?

Was it helpful?

Solution

create a new folder protected/serviceLayer

import this folder in your config/main.php

'import' => array('application.serviceLayer.*')

create a component in your protected/serviceLayer- folder

call it wherever you want

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top