Documentation
Custom relative service directory
Custom relative service directory
Set a shared base path so service class references stay short and consistent.
If all your application starts from the same source directory may will be easy for you to add a custom relative service directory
Imagine you have the following directory structure
config/services.ymlsrc/Kernel.jssrc/services/SomeCoolManager.jssrc/authorization/Authentication.js
Instead of defining a relative path from your services.yml you can actually
set a starting point for your dependencies.
Kernel file
import {ContainerBuilder}
import path from 'path';
const srcDir = path.join(__dirname);
const container = new ContainerBuilder(true, srcDir);
So, basically, the second parameter when ContainerBuilder is instantiate is the source directory. Then your configuration file will look like this:
services:
app.SomeCoolManager:
class: services/SomeCoolManager
app.Authentication:
class: authorization/Authentication
