zendframework/zf2 — pull request #6843 by blanchonvincent (2014-11-05 09:48:06+00:00)
Title: [ServiceManager] synchronized services

Sometimes, when a services is updated in the ServiceManager, we need to notify all services that have a dependence to this service.

The idea there is to allow an interface to implement `Zend\ServiceManager\SynchronizedFactoryInterface` to update the service biult previously :

```php
class BarSynchronizedFactory implements FactoryInterface, SynchronizedFactoryInterface
{
/**
* @var Bar
*/
protected $bar;

public function createService(ServiceLocatorInterface $serviceLocator)
{
$this->bar = new Bar(array('foo'));

return $this->bar;
}

/**
* @param SplSubject|SynchronizerInterface $subject
*/
public function update(SplSubject $subject)
{
$service = $subject->toSynchronize();

$this->bar->foo = $service;
}

/**
* Return a list of services that will be synchronized to the factory
*
* @return array
*/
public function getServices()
{
return 'foo';
}
}
```