I don't mean to be discouraging, but based on your description I'm not
convinced this is necessary, or results in a net reduction of code for a
typical application.

It's what I call "waterbed programming".  You push complexity down on
the one side, but it bulges out on the other side.  So you don't make
your app less complex, but you do increase the amount of code to
maintain.

You can probably get most of the benefit you're seeking by using
Zend_Config and Zend_Registry.

Regards,
Bill Karwin 

> -----Original Message-----
> From: Felix Jendrusch [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 02, 2007 7:21 AM
> To: [email protected]
> Subject: [fw-general] Component Manager
> 
> 
> Yesterday I started thinking about something like a component 
> manager. My first implementation supports:
> 
> - Class/File loading on demand (using Zend_Loader)
> - Configuration in the bootstrap file without loading the 
> classes/files (you can specify arguments that will be passed 
> to the constructor/a static method, e.g. Zend_Db::factory)
> - Singleton pattern possible for every component (e.g. Zend_Db)
> - Dependencies (e.g. Zend_Db_Table needs a database adapter)
> 
> I'm thinking about other features like automatic caching for 
> components like Zend_Acl. Examples:
> 
> Bootstrap:
> 
> $component = new Zend_Components_Component('db'); 
> $component->setClassName('Zend_Db');
> $component->setMethodName('factory');
> $component->setArguments(array('Pdo_Mysql', array('host' => 
> 'myhost', 'username' => 'myusername', 'password' => 
> 'mypassword', 'dbname' => 'mydbname')));
> 
> $component->register();
> 
> or
> 
> $components = Zend_Components::getInstance(); 
> $components->registerComponent($component);
> 
> Controller:
> 
> $db = Zend_Components::getInstance('db');
> 
> Bootstrap:
> 
> $options = array('className' => 'Zend_Db', 'methodName' => 
> 'factory', 'arguments' => array('Pdo_Mysql', array('host' => 
> 'myhost', 'username' => 'myusername', 'password' => 
> 'mypassword', 'dbname' => 'mydbname')));
> 
> $components = Zend_Components::getInstance(); 
> $components->registerComponent('db', $options);
> 
> Controller:
> 
> $components = Zend_Components::getInstance(); $component = 
> $components->getComponent('db'); $db = $component->getInstance();
> 
> Bootstrap (including one of the examples above):
> 
> class accounts extends Zend_Db_Table {}
>  
> $component = new Zend_Components_Component('accounts');
> $component->setArguments(array(array('db' => 
> array(Zend_Components_Component::DEPENDENCY, 'db')))); 
> $component->register();
> 
> Controller:
>  
> $table = Zend_Components::getInstance('accounts');
> 
> Just an example for the dependency feature. Feedback? :>
> --
> View this message in context: 
> http://www.nabble.com/Component-Manager-tf4206384s16154.html#a11965335
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 

Reply via email to