xPDO.getService
Last updated not available | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$185 per month—let's make that $500!
Learn morexPDO::getService¶
Loads a service class and returns an instance of it, or the already-loaded instance when the service has been requested before in the current request.
[!WARNING]
getService()is deprecated since xPDO 3.0 and will be removed in 3.1. Access services through the dependency injection container instead.
Syntax¶
object|boolean getService (string $name, [string $class = ''], [string $path = ''], [array $params = array()])
$name— the name the service is stored under.$class— the class name of the service.$path— the path to the class file.$params— constructor parameters for the service.
Example¶
$service = $xpdo->getService('myService', 'myServiceClass', '/path/to/model/root/', array('param1' => $param1));
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$185 per month—let's make that $500!
Learn more










