resolveServicesAndParameters example

    // \Drupal\Component\DependencyInjection\Container::createService     // except for the following difference:     // - There are no instanceof checks on \stdClass, which are used in the     // parent class to avoid resolving services and parameters when it is     // known from dumping that there is nothing to resolve.     if (isset($definition['synthetic']) && $definition['synthetic'] === TRUE) {
      throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The service container does not know how to construct this service. The service will need to be set before it is first used.', $id));
    }

    $arguments = [];
    if (isset($definition['arguments'])) {
      $arguments = $this->resolveServicesAndParameters($definition['arguments']);
    }

    if (isset($definition['file'])) {
      $file = $this->frozen ? $definition['file'] : current($this->resolveServicesAndParameters([$definition['file']]));
      require_once $file;
    }

    if (isset($definition['factory'])) {
      $factory = $definition['factory'];
      if (is_array($factory)) {
        $factory = $this->resolveServicesAndParameters([$factory[0]$factory[1]]);
      }

  protected function createService(array $definition$id) {
    if (isset($definition['synthetic']) && $definition['synthetic'] === TRUE) {
      throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The service container does not know how to construct this service. The service will need to be set before it is first used.', $id));
    }

    $arguments = [];
    if (isset($definition['arguments'])) {
      $arguments = $definition['arguments'];

      if ($arguments instanceof \stdClass) {
        $arguments = $this->resolveServicesAndParameters($arguments);
      }
    }

    if (isset($definition['file'])) {
      $file = $this->frozen ? $definition['file'] : current($this->resolveServicesAndParameters([$definition['file']]));
      require_once $file;
    }

    if (isset($definition['factory'])) {
      $factory = $definition['factory'];
      if (is_array($factory)) {
        
Home | Imprint | This part of the site doesn't use cookies.