* {@inheritdoc}
*/
public function __construct(ParameterBagInterface $parameterBag = NULL) {
- $this->setResourceTracking(FALSE);
parent::__construct($parameterBag);
+ $this->setResourceTracking(FALSE);
}
/**
}
/**
- * Direct copy of the parent function.
+ * A 1to1 copy of parent::shareService.
+ *
+ * @todo https://www.drupal.org/project/drupal/issues/2937010 Since Symfony
+ * 3.4 this is not a 1to1 copy.
*/
- protected function shareService(Definition $definition, $service, $id)
+ protected function shareService(Definition $definition, $service, $id, array &$inlineServices)
{
- if ($definition->isShared() && self::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
- if (self::SCOPE_CONTAINER !== $scope && !isset($this->scopedServices[$scope])) {
- throw new InactiveScopeException($id, $scope);
- }
-
+ if ($definition->isShared()) {
$this->services[$lowerId = strtolower($id)] = $service;
-
- if (self::SCOPE_CONTAINER !== $scope) {
- $this->scopedServices[$scope][$lowerId] = $service;
- }
}
}
* ContainerBuilder class should be fixed to allow setting synthetic
* services in a frozen builder.
*/
- public function set($id, $service, $scope = self::SCOPE_CONTAINER) {
+ public function set($id, $service) {
if (strtolower($id) !== $id) {
throw new \InvalidArgumentException("Service ID names must be lowercase: $id");
}
- SymfonyContainer::set($id, $service, $scope);
+ SymfonyContainer::set($id, $service);
// Ensure that the _serviceId property is set on synthetic services as well.
if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
return parent::register($id, $class);
}
+ /**
+ * {@inheritdoc}
+ */
+ public function setAlias($alias, $id) {
+ $alias = parent::setAlias($alias, $id);
+ // As of Symfony 3.4 all aliases are private by default.
+ $alias->setPublic(TRUE);
+ return $alias;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setDefinition($id, Definition $definition) {
+ $definition = parent::setDefinition($id, $definition);
+ // As of Symfony 3.4 all definitions are private by default.
+ // \Symfony\Component\DependencyInjection\Compiler\ResolvePrivatesPassOnly
+ // removes services marked as private from the container even if they are
+ // also marked as public. Drupal requires services that are public to
+ // remain in the container and not be removed.
+ if ($definition->isPublic()) {
+ $definition->setPrivate(FALSE);
+ }
+ return $definition;
+ }
+
/**
* {@inheritdoc}
*/
/**
* A 1to1 copy of parent::callMethod.
+ *
+ * @todo https://www.drupal.org/project/drupal/issues/2937010 Since Symfony
+ * 3.4 this is not a 1to1 copy.
*/
- protected function callMethod($service, $call) {
+ protected function callMethod($service, $call, array &$inlineServices = array()) {
$services = self::getServiceConditionals($call[1]);
foreach ($services as $s) {