You are here

public function Definition::addMethodCall in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Definition.php \Symfony\Component\DependencyInjection\Definition::addMethodCall()

Adds a method to call after service initialization.

@api

Parameters

string $method The method name to call:

array $arguments An array of arguments to pass to the method call:

Return value

Definition The current instance

Throws

InvalidArgumentException on empty $method param

1 call to Definition::addMethodCall()
Definition::setMethodCalls in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Definition.php
Sets the methods to call after service initialization.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Definition.php, line 406

Class

Definition
Definition represents a service definition.

Namespace

Symfony\Component\DependencyInjection

Code

public function addMethodCall($method, array $arguments = array()) {
  if (empty($method)) {
    throw new InvalidArgumentException(sprintf('Method name cannot be empty.'));
  }
  $this->calls[] = array(
    $method,
    $arguments,
  );
  return $this;
}