adtechpotok / symfony-aware
Aware bundle
Installs: 51
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/adtechpotok/symfony-aware
Requires
- php: >=7.1
- doctrine/doctrine-bundle: ^1.8
- doctrine/orm: ^2.6
- symfony/framework-bundle: ^3.4|^4.1
- symfony/messenger: ^4.1.0
- symfony/property-access: ^3.4|^4.1
- symfony/security: ^3.4|^4.1
- symfony/stopwatch: ^3.4|^4.1
- symfony/translation: ^3.4|^4.1
Requires (Dev)
- lookyman/phpstan-symfony: dev-master
This package is not auto-updated.
Last update: 2025-10-26 11:55:17 UTC
README
Aware
Пример использования
Сервис
<?php use Adtechpotok\Aware\Interfaces\EntityManagerAwareInterface; use Adtechpotok\Aware\Traits\EntityManagerAwareTrait; class SomeClass implements EntityManagerAwareInterface { use EntityManagerAwareTrait; public function someMethod() { dump($this->em); // $em - дефолтный EntityManager, аналог '@doctrine.orm.default_entity_manager' } }
Объявление сервиса
services: some.service: class: SomeClass calls: - {method: setEntityManager, arguments: ['@doctrine.orm.default_entity_manager']}
Таблица соответствий
| Aware | Service |
|---|---|
| ConnectionAware | @doctrine.dbal.default_connection |
| CacheAware | @cache.app |
| ContainerAware | @service_container |
| DoctrineAware | @doctrine |
| EntityManagerAware | @doctrine.orm.default_entity_manager |
| EventDispatcherAware | @debug.event_dispatcher |
| FilesystemAware | @filesystem |
| FileLocatorAware | @file_locator |
| FileLinkFormatterAware | @debug.file_link_formatter |
| HttpKernelAware | @http_kernel |
| KernelAware | @kernel |
| LoggerAware | @monolog.logger |
| PropertyAccessorAware | @property_accessor |
| ReaderAware | @annotations.cached_reader |
| RequestStackAware | @request_stack |
| StopwatchAware | @debug.stopwatch |
Объявление сервиса в Symfony >= 3.3
services: _defaults: autowire: true some.service: class: SomeClass
Важно! При объявлении сервисов, которые требуют использования тэгов - этот способ не подоходит, Symfony игнорирует тэги при autowire.