You are here

public function Definition::addMethodCall in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Definition.php \Symfony\Component\DependencyInjection\Definition::addMethodCall()

Adds a method to call after service initialization.

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 vendor/symfony/dependency-injection/Definition.php
Sets the methods to call after service initialization.

File

vendor/symfony/dependency-injection/Definition.php, line 369

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;
}