php - Question regarding MVC: SubClass for DB activity -


I just recently had OOP & amp; Now using MVC and this template engine:

Where have I placed my DB calls, but I'm curious about a question (I'm using a basic database wrapper class).

We have seen two ways.

Category Cart

  / ** * Item count in cart * @ Layer intern / Public counting counting function () {require_once (DATABASE. 'Cartext.php' ); $ Info = User :: getInfo (); $ Count = CartExt :: inCart ($ info ['0'] ['userid']); Return $ count; }  

Then in the class cart

  / ** * User cart count * @ Ultimate intra * return int * / public static function inCart ($ shopperID) {$ Db = Database :: getInstance (); $ Query = $ db- & gt; Execute ("Selection from Listing" where shopperid = '$ shopperID' "); $ Count = 0; While ($ line = $ db--gt; get all ($ query)) {$ count ++; } Return $ count; }  

With big functions, I can see the benefit of separating two, but as a later example, it is very similar to brain, or worse: Base Class Just calls ext. And returns its value!

Anyway, I just want some ideas on this.

In addition, I am doing a correct_once function to reduce the http requests from

In addition, I am right that I have $ $ _POST in the controller '] Should handle it and pass it as an absolute thing to my actions, should it be opposed to handle in the classroom? (I'm not using any Form Object / Class yet)

Want to hear your thoughts on this.

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -