Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Edited example 15 with a working workflow against Zend\Di
  • Loading branch information
Ralph Schindler committed Nov 2, 2011
1 parent 5407f92 commit 0bc9424
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions example-15.php
Expand Up @@ -25,8 +25,8 @@ class DriverTwo implements \System\Driver {}
'definition' => array(
'class' => array(
'System\Mapper' => array(
'addBlock' => array(
'driver' => array('type' => 'Application\Block', 'required' => true),
'addDriver' => array(
'driver' => array('type' => 'System\Driver', 'required' => true),
'name' => array('required' => true)
)
)
Expand All @@ -35,20 +35,22 @@ class DriverTwo implements \System\Driver {}
'instance' => array(
'System\Mapper' => array(
'injections' => array(
array('block' => 'DifferentNs\DriverOne', 'name' => 'foo'),
array('block' => 'DifferentNs\DriverTwo', 'name' => 'bar')
'addDriver' => array(
array('driver' => 'DifferentNs\DriverOne', 'name' => 'foo'),
array('driver' => 'DifferentNs\DriverTwo', 'name' => 'bar')
)
)
)
)
)));
$page = $di->get('System\Mapper');
$mapper = $di->get('System\Mapper');

// expression to test
$works = (
$page->blocks[0][0] instanceof DifferentNs\DriverOne
&& $page->blocks[1][0] instanceof DifferentNs\DriverTwo
$mapper->drivers[0][0] instanceof DifferentNs\DriverOne
&& $mapper->drivers[1][0] instanceof DifferentNs\DriverTwo
);

var_dump($mapper);
// display result
echo (($works) ? 'It works!' : 'It DOES NOT work!');
}

0 comments on commit 0bc9424

Please sign in to comment.