Returns service instances to persist from an old container to a new one.
protected function getServicesToPersist() {
$persist = array();
if (isset($this->container)) {
foreach ($this->container
->getParameter('persistIds') as $id) {
// It's pointless to persist services not yet initialized.
if ($this->container
->initialized($id)) {
$persist[$id] = $this->container
->get($id);
}
}
}
return $persist;
}