Re: OO oriented PHP frameworks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 6, 2011 at 12:36 PM, Jerome Covington <jeromecovington@xxxxxxxxx
> wrote:

> I was specifically curious if there are frameworks which use the convention
> of passing config objects to functions/methods in the same way that
> contemporary JS libraries like jQuery do.


We use Zend Framework along with its MVC framework. In the Bootstrap class
initialized from index.php we load an INI file into a Zend_Config object
which parses it into a hierarchical array, and store the config in the
Zend_Registry--essentially making it a global variable (Singleton pattern).

Instead of passing it around to the objects that need it, each class
accesses it directly from the registry. While this couples these classes to
the registry, it makes the code simpler. Were I to write it from scratch, I
would have created a helper object that passes the config object to each
controller as it's created, whether it needed it or not. That would make one
class (the helper) dependent on the registry instead of every controller
that accesses the config object.

David

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux