Instead of component managment only available to Yii::app()
$config = array(
'comp1' => array(
'class' => '...',
... other option ..
),
'comp2' => array(
'class' => '...',
... other option ..
),
);
$a = new ComponentManager($config);
$b = new ComponentManager($config);
$a->comp1-> ...
$b->comp2-> ...
Page 1 of 1
Component management design as a pattern
#1
Posted 07 October 2011 - 03:37 AM
#4
Posted 08 October 2011 - 02:59 AM
The case is in general meaning, Coders can create their own ComponentManager at any point of time to make use of the ComponentManager's powerful lazyloading and object registry functionity, that will be a great helper to app design.
Event a temporary componentSet:
$a = new ComponentManager($TempConfig); //create a new temporary componentSet
... do sth. ... such as:
$a->comp1->blah();
$a->comp2->foo();
unset($a); // when I don't need it.
Event a temporary componentSet:
$a = new ComponentManager($TempConfig); //create a new temporary componentSet
... do sth. ... such as:
$a->comp1->blah();
$a->comp2->foo();
unset($a); // when I don't need it.
#6
Posted 10 October 2011 - 02:20 AM
One potential advantage of this could be, when you have many application components with lot of configuration. In that case you could move all that config to another file and only load it inside your custom component manager. On the other hand you can also achieve that by dynamically adding a component to the webapplication. So i also can't really see why a custom component manager is more useful than using an application component in the first place
.
#7
Posted 19 October 2011 - 09:38 AM
you can set it in main.php
'components'=>array_merge(include_once('path_to_your_components_settings_1'), include_once('path_to_your_components_settings_2'));
Share this topic:
Page 1 of 1

Help

This topic is locked














