Personally, I try very hard to push all the heavy lifting off to models;
but, after reading the chapter linked, it seems I have to admit I'm
guilty of using controllers as "data police".
My scenario: the controller merges some global/local config information
in order to create a database connection specific to it's needs. It
then passes an instance of Zend_Config to the constructor of a database
manager class (model), which actually spawns a connection. The
controller then asks the database manager for information, particular to
the needs of whatever action is called for, and assigns the results to
the view without ever actually "using" said information itself.
So is this functionality better handled by the view?
Sorry for hijacking the thread :)
Dalibor Karlović wrote:
On Thursday 28 May 2009 02:27:03 Steven Szymczak wrote:
Why wouldn't you?
If you have access to a DB instance inside your controller, you're more
inclined to use it. :) Which leads to FSUCs. [1]
[1] http://sn.im/ixdgi
Dalibor Karlović wrote:
On Tuesday 26 May 2009 20:40:38 Vladas Diržys wrote:
Hi,
what is the right way to get a db (or any other) resource in the
controller? Now I'm using following line:
$this->getFrontController()->getParam('bootstrap')->getResource('db');
Why do you need you DB instance inside your controller?