This repository was archived by the owner on Feb 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
7.x 2.x service container
Andy Truong edited this page Jan 16, 2014
·
9 revisions
Dependency help our code clean, testable…
The Service Container in this module is built on Pimple.
If we defined
# /at_base/tests/atest_base/config/services.yml
services:
atest_base.service_1:
class: 'Drupal\atest_base\Service_1'
atest_base.service_2:
class: 'Drupal\atest_base\Service_2'
arguments: ['@atest_base.service_1']We can get instance of service_2:
$service_2 = at_container('atest_base.service_2');Get all services tagged with 'cache.warmer':
$name_of_services = at_container('container')->find('cache.warmer', $return = 'service_name');
$obj_of_servcies = at_container('container')->find('cache.warmer', $return = 'service'); ___ ___________ _ _
/ _ \_ _| ___ \ | | | |
/ /_\ \| | | |_/ / __ _ ___ ___ _ __ ___ ___ __| |_ _| | ___
| _ || | | ___ \/ _` / __|/ _ \ | '_ ` _ \ / _ \ / _` | | | | |/ _ \
| | | || | | |_/ / (_| \__ \ __/_| | | | | | (_) | (_| | |_| | | __/
\_| |_/\_/ \____/ \__,_|___/\___(_)_| |_| |_|\___/ \__,_|\__,_|_|\___|
- Caching
- Twig template
- twig Service
- twig_string Service
- Recipes
- Extends
- Easy Block
- Easy Routing
- Easy Breadcrumb
- Entity Template
- Drush Commands:
- Functions:
- Misc
- Status
- Tools for Development enviroment
- /devel/php improved
- /at/sql
- /at/twig
- Kint integration