# 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: locale: en app_locales: en|de 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. public: false # Allows optimizing the container by removing unused services; this also means # fetching services directly from the container via $container->get() won't work. # The best practice is to be explicit about your dependencies anyway. # 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/{Entity,Migrations,Tests}' # 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 # ================================================================================ # APPLICATION CORE # ================================================================================ # a route listener, that injects the locale through a URL directory App\EventSubscriber\RedirectToLocaleSubscriber: class: App\EventSubscriber\RedirectToLocaleSubscriber arguments: ['@router', '%app_locales%', '%locale%'] tags: - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } # ================================================================================ # DATABASE # ================================================================================ # service that prefixes every database table app.tableprefix_subscriber: class: App\Doctrine\TablePrefixSubscriber arguments: ["%env(resolve:DATABASE_PREFIX)%"] tags: - { name: doctrine.event_subscriber } # updates timesheet records, to make sure they are calculated and can't be manipulated by the users app.database_listener.timesheet: class: App\Doctrine\TimesheetSubscriber tags: - { name: doctrine.event_listener, event: prePersist, lazy: true } - { name: doctrine.event_listener, event: preUpdate, lazy: true } # Uncomment the following lines to define a service for the Timesheet Doctrine repository. # It's not mandatory to create these services, but if you use repositories a lot, # these services can simplify your code: # # app.post_repository: # class: Doctrine\ORM\EntityRepository # factory: ['@doctrine.orm.entity_manager', getRepository] # arguments: [App\Entity\Timesheet] # # // traditional code inside a controller # $entityManager = $this->getDoctrine()->getManager(); # $posts = $entityManager->getRepository('KimaiBundle:User')->findAll(); # # // same code using repository services # $posts = $this->get('app.user_repository')->findAll(); # ================================================================================ # FORMS # ================================================================================ # form type to edit user roles App\Form\Type\UserRoleType: class: App\Form\Type\UserRoleType arguments: ["%security.role_hierarchy.roles%"] tags: - { name: form.type } # ================================================================================ # CONSOLE COMMANDS # ================================================================================ App\Command\RunCodeSnifferCommand: arguments: $projectDirectory: "%kernel.project_dir%" App\Command\RunUnitTestsCommand: class: App\Command\RunUnitTestsCommand arguments: $projectDirectory: "%kernel.project_dir%" App\Command\RunIntegrationTestsCommand: class: App\Command\RunIntegrationTestsCommand arguments: $projectDirectory: "%kernel.project_dir%" App\Command\InstallCommand: class: App\Command\InstallCommand arguments: $projectDirectory: "%kernel.project_dir%" # ================================================================================ # THEME # ================================================================================ App\Twig\Extensions: arguments: ['%app_locales%'] # avanzu_admin_theme.navbar_task_listener: # class: "%avanzu_admin_theme.navbar_task_listener.class%" # tags: # - { name: kernel.event_listener, event: theme.tasks, method: onListTasks } # # avanzu_admin_theme.navbar_notify_listener: # class: "%avanzu_admin_theme.navbar_notify_listener.class%" # tags: # - { name: kernel.event_listener, event: theme.notifications, method: onListNotifications } # # avanzu_admin_theme.navbar_msg_listener: # class: "%avanzu_admin_theme.navbar_msg_listener.class%" # tags: # - { name: kernel.event_listener, event: theme.messages, method: onListMessages } # # avanzu_admin_theme.setup_menu_listener: # class: "%avanzu_admin_theme.setup_menu_listener.class%" # tags: # - { name: kernel.event_listener, event: theme.sidebar_setup_menu, method: onSetupMenu } # - { name: kernel.event_listener, event: theme.breadcrumb, method: onSetupMenu }