Documentation

目次

前のトピックへ

< Abstract class Phalcon\DI\Injectable

次のトピックへ

Class Phalcon\DI\Service\Builder >

このページ

Class Phalcon\DI\Service

implements Phalcon\DI\ServiceInterface

Represents individually a service in the services container

<?php

 $service = new Phalcon\DI\Service('request', 'Phalcon\Http\Request');
 $request = $service->resolve();
<?php

Methods

public __construct (string $name, mixed $definition, [boolean $shared])

public getName ()

Returns the service’s name

public setShared (boolean $shared)

Sets if the service is shared or not

public boolean isShared ()

Check whether the service is shared or not

public setSharedInstance (mixed $sharedInstance)

Sets/Resets the shared instance related to the service

public setDefinition (mixed $definition)

Set the service definition

public mixed getDefinition ()

Returns the service definition

public mixed resolve ([array $parameters], [Phalcon\DiInterface $dependencyInjector])

Resolves the service

public Phalcon\DI\Service setParameter (long $position, array $parameter)

Changes a parameter in the definition without resolve the service

public array getParameter (int $position)

Returns a parameter in a specific position

public static Phalcon\DI\Service __set_state (array $attributes)

Restore the internal state of a service