Created
March 27, 2013 07:06
-
-
Save nclundsten/5252337 to your computer and use it in GitHub Desktop.
example for: service manager key: 'shared'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'invokables' => array( | |
'my_uninitialized_mapper' => 'Module\Mapper\MyMapper', | |
), | |
'factories' => array( | |
'some_table_mapper' => function ($sm) { | |
$mapper = $sm->get('my_uninitialized_mapper'); | |
$mapper->setTableName('some_table'); | |
$mapper->setDbAdapter($sm->get('module_db_adapter')); | |
}, | |
'other_table_mapper' => function ($sm) { | |
$mapper = $sm->get('my_uninitialized_mapper'); | |
$mapper->setTableName('other_table'); | |
$mapper->setDbAdapter($sm->get('module_db_adapter')); | |
}, | |
), | |
/* | |
* in the factories above, both returned instances start with the same | |
* uninitialized mapper, but have different table names | |
* this would cause issues if you did not disable sharing. | |
*/ | |
'shared' => array( | |
'my_uninitialized_mapper' => false, //default is true | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment