getServiceAlternatives example

if (isset($this->loading[$id])) {
      throw new ServiceCircularReferenceException($idarray_keys($this->loading));
    }

    $definition = $this->serviceDefinitions[$id] ?? NULL;

    if (!$definition && $invalid_behavior === ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
      if (!$id) {
        throw new ServiceNotFoundException('');
      }

      throw new ServiceNotFoundException($id, NULL, NULL, $this->getServiceAlternatives($id));
    }

    // In case something else than ContainerInterface::NULL_ON_INVALID_REFERENCE     // is used, the actual wanted behavior is to re-try getting the service at a     // later point.     if (!$definition) {
      return NULL;
    }

    // Definition is a keyed array, so [0] is only defined when it is a     // serialized string.
Home | Imprint | This part of the site doesn't use cookies.