Skip to content

Instantly share code, notes, and snippets.

@ArchTaqi
Last active July 10, 2019 11:13
Show Gist options
  • Save ArchTaqi/4e47685637f2a399c417674acfe43435 to your computer and use it in GitHub Desktop.
Save ArchTaqi/4e47685637f2a399c417674acfe43435 to your computer and use it in GitHub Desktop.
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
app.post.manager:
class: App\Entity\Manager\PostManager
arguments:
- "@doctrine.orm.entity_manager"
app.service.post:
class: App\Services\PostService
autowire: false
arguments: ['@app.post.manager', '@event_dispatcher', '@validator']
app.event_listener.post:
class: App\EventListener\PostListener
autowire: false
tags:
- { name: kernel.event_listener, event: okApp.pre_validate, method: preValidate }
- { name: kernel.event_listener, event: okApp.pre_flush, method: onPreFlush }
- { name: kernel.event_listener, event: okApp.post_flush, method: onPostFlush }
arguments: ['@app.service.post']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment