Files
kimai2/config/services.yaml
Kevin Papst db5b6f8e2e added russian translation #95 (#147)
* added russian translation #95
* added config for duration_only mode and adjusted timesheet views #131
2018-06-02 19:57:12 +02:00

92 lines
3.9 KiB
YAML

# 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|ru
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.
bind:
$projectDirectory: "%kernel.project_dir%"
$durationOnly: "%kimai.timesheet.duration_only%"
# 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']
# ================================================================================
# APPLICATION CORE
# ================================================================================
App\Invoice\ServiceInvoice:
class: App\Invoice\ServiceInvoice
arguments: ['%kimai.invoice%']
# a route listener, that injects the default locale into the route
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\Doctrine\TablePrefixSubscriber:
class: App\Doctrine\TablePrefixSubscriber
arguments: ["%env(resolve:DATABASE_PREFIX)%"]
tags:
- { name: doctrine.event_subscriber }
# updates timesheet records and apply configured rate & rounding rules
App\Doctrine\TimesheetSubscriber:
class: App\Doctrine\TimesheetSubscriber
arguments: [!tagged timesheet.calculator]
tags:
- { name: doctrine.event_listener, event: prePersist, lazy: true }
- { name: doctrine.event_listener, event: preUpdate, lazy: true }
# ================================================================================
# 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 }
# ================================================================================
# THEME
# ================================================================================
App\Twig\Extensions:
arguments: ['%app_locales%']
# ================================================================================
# TIMESHEET RECORD CALCULATOR
# ================================================================================
App\Timesheet\Calculator\DurationCalculator:
arguments: ["%kimai.timesheet.rounding%"]
App\Timesheet\Calculator\RateCalculator:
arguments: ["%kimai.timesheet.rates%"]