0

I'm using aBound yii template for my app. on the left side there is a div with information. But in the template the info is static. I want to access model data, and trying NOT to break MVC pattern.

1) where is the right place to create a Count function ? for example, how many active clients are in the database, is it in Client Model or in Client Controller ?

2) should it be static ?

1
  • Regardless of why you want that or how could it be implemented, as a general hint, this breaks MVC philosophy. Try to check, again, your code logic and data flow.
    – SaidbakR
    Dec 25, 2014 at 11:00

2 Answers 2

0

1) The better approach is to make this function in Client Model, you might use scopes for this.

2) This is static function, since it does not depend on an model instance.

0

Create a widget under /extensions directory. This is more portable within your application. http://www.yiiframework.com/doc/guide/1.1/en/extension.create#widget

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.