1)
You can use any model from any module in your application, so they can be "shared". Fro example you use the ServiceManager to help you grab instances of models (and other classes) in your project.
Service Manager Config:
'factories' => array(
'AuthService' => function($sm) {
$auth = new \Zend\Authentication\AuthenticationService();
return $auth;
},
'RoleMapper' => function($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$mapper = new \Application\Mapper\RoleMapper;
$mapper->setDbAdapter($dbAdapter);
$mapper->setEntityPrototype(new \Application\Model\Role);
$mapper->setHydrator(new \Application\Model\RoleHydrator);
return $mapper;
},
'UserMapper' => function($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$mapper = new \MyModule\Mapper\UserMapper;
$mapper->setDbAdapter($dbAdapter);
$mapper->setEntityPrototype(new \MyModule\Model\User);
$mapper->setHydrator($sm->get('UserHydrator'));
return $mapper;
},
....
As you can see you can have classes from multiple modules defined in there. Usually you would just define a separate ServiceManager config for each module though.
There's nothing to stop you from making an instance of "UserMapper" inside your Application module like this:
Some Controller:
$this->getServiceLocator()->get('UserMapper');
// Or even grab Zend libraries like this
$this->getServiceLocator()->get('AuthService');
The ServiceManager will allow you to grab instances of classes from any of your modules inside any of the others with a problem.
2)
The service manager doesn't actually make an instance of anything until you request it, so there's no overhead as you suggest.
From the example above, there's no instances actually created until you first ask for one:
$this->getServiceLocator()->get('UserMapper'); // instance now created.
If you never ask the service manager for a "RoleMapper" for example, then no instance is created.