Symfony\Component\DependencyInjection\Definition::getDecoratedService PHP Method

getDecoratedService() public method

Gets the service that decorates this service.
public getDecoratedService ( ) : null | array
return null | array An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated
    public function getDecoratedService()
    {
        return $this->decoratedService;
    }

Usage Example

Exemplo n.º 1
0
    public function testSetGetDecoratedService()
    {
        $def = new Definition('stdClass');
        $this->assertNull($def->getDecoratedService());
        $def->setDecoratedService('foo', 'foo.renamed', 5);
        $this->assertEquals(array('foo', 'foo.renamed', 5), $def->getDecoratedService());
        $def->setDecoratedService(null);
        $this->assertNull($def->getDecoratedService());

        $def = new Definition('stdClass');
        $this->assertNull($def->getDecoratedService());
        $def->setDecoratedService('foo', 'foo.renamed');
        $this->assertEquals(array('foo', 'foo.renamed', 0), $def->getDecoratedService());
        $def->setDecoratedService(null);
        $this->assertNull($def->getDecoratedService());

        $def = new Definition('stdClass');
        $def->setDecoratedService('foo');
        $this->assertEquals(array('foo', null, 0), $def->getDecoratedService());
        $def->setDecoratedService(null);
        $this->assertNull($def->getDecoratedService());

        $def = new Definition('stdClass');
        $this->setExpectedException('InvalidArgumentException', 'The decorated service inner name for "foo" must be different than the service name itself.');
        $def->setDecoratedService('foo', 'foo');
    }
All Usage Examples Of Symfony\Component\DependencyInjection\Definition::getDecoratedService