Version 5 by Evan Coury
on Aug 03, 2011 14:55.

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (8)

View Page History
{code:php}
$di = new Zend\Di\DependencyInjector;
$di->getInstanceManager()->setProperty('A', 'username', 'MyUsernameValue');
$di->getInstanceManager()->setProperty('A', 'password', 'MyHardToGuessPassword%$#');
$di->getInstanceManager()->setParameters('A', array(
'username' => 'MyUsernameValue',
'password' => 'MyHardToGuessPassword%$#'
);
{code}

$di = new Zend\Di\DependencyInjector;
$di->setDefinition($definition);
$di->getInstanceManager()->setProperty('My\A', 'username', 'foo');
$di->getInstanceManager()->setProperty('My\A', 'password', 'bar');
$di->getInstanceManager()->setParameters('My\A', array('username' => 'foo', 'password' => 'bar'));
$c = $di->get('My\C');
{code}

// this could come from Zend\Config\Config::toArray
$propertiesFromConfig $paramsFromConfig = array(
'ThirdParty\Dbal\DbAdapter' => array(
'username' => 'someUsername',
),
);
foreach ($propertiesFromConfig as $classParams {
$im->setParameters($classParams);
$im->setProperties($propertiesFromConfig); }

{code}