DI\Definition\ObjectDefinition::setScope PHP Method

setScope() public method

public setScope ( string $scope )
$scope string
    public function setScope($scope)
    {
        $this->scope = $scope;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function getDefinition($entryName)
 {
     $definition = new ObjectDefinition($entryName, $this->className);
     if ($this->lazy !== null) {
         $definition->setLazy($this->lazy);
     }
     if ($this->scope !== null) {
         $definition->setScope($this->scope);
     }
     if (!empty($this->constructor)) {
         $parameters = $this->fixParameters($definition, '__construct', $this->constructor);
         $constructorInjection = MethodInjection::constructor($parameters);
         $definition->setConstructorInjection($constructorInjection);
     }
     if (!empty($this->properties)) {
         foreach ($this->properties as $property => $value) {
             $definition->addPropertyInjection(new PropertyInjection($property, $value));
         }
     }
     if (!empty($this->methods)) {
         foreach ($this->methods as $method => $calls) {
             foreach ($calls as $parameters) {
                 $parameters = $this->fixParameters($definition, $method, $parameters);
                 $methodInjection = new MethodInjection($method, $parameters);
                 $definition->addMethodInjection($methodInjection);
             }
         }
     }
     return $definition;
 }
All Usage Examples Of DI\Definition\ObjectDefinition::setScope