-
Notifications
You must be signed in to change notification settings - Fork 34
CustomRelativeServiceDirectory
Mauro Gadaleta edited this page Mar 28, 2019
·
1 revision
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.yml
src/Kernel.js
src/services/SomeCoolManager.js
src/authorization/Authentication.js
Instead of defining a relative path from your services.yml
you can actually
set a starting point for your dependencies.
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
Copyright © 2023-2024 Mauro Gadaleta