Air-Quality-Web/di_config.php

39 lines
1.4 KiB
PHP
Raw Normal View History

<?php
use Psr\Container\ContainerInterface;
use SBRL\TomlConfig;
2019-06-20 23:02:26 +00:00
// use AirQuality\Database;
2019-01-15 16:37:46 +00:00
use AirQuality\Repositories\IDeviceRepository;
use AirQuality\Repositories\MariaDBDeviceRepository;
use AirQuality\Repositories\IMeasurementDataRepository;
use AirQuality\Repositories\MariaDBMeasurementDataRepository;
use AirQuality\Repositories\IMeasurementTypeRepository;
use AirQuality\Repositories\MariaDBMeasurementTypeRepository;
2019-07-18 21:18:30 +00:00
use AirQuality\Repositories\ISensorRepository;
use AirQuality\Repositories\MariaDBSensorRepository;
2019-06-20 23:02:26 +00:00
use SBRL\PerformanceCounter;
return [
"settings.file_default" => "data/settings.toml",
"settings.file_custom" => "settings.default.toml",
2019-06-20 23:02:26 +00:00
// These are created during initalisation, but we want them available via dependency injection too
2019-01-15 19:19:17 +00:00
TomlConfig::class => function(ContainerInterface $c) {
global $settings;
return $settings;
},
2019-06-20 23:02:26 +00:00
PerformanceCounter::class => function(ContainerInterface $c) {
global $perfcounter;
return $perfcounter;
},
2019-06-20 23:02:26 +00:00
// Interfaces that need mapping to their implementations
IDeviceRepository::class => DI\autowire(MariaDBDeviceRepository::class),
IMeasurementDataRepository::class => DI\autowire(MariaDBMeasurementDataRepository::class),
2019-07-18 21:18:30 +00:00
IMeasurementTypeRepository::class => DI\autowire(MariaDBMeasurementTypeRepository::class),
ISensorRepository::class => DI\autowire(MariaDBSensorRepository::class)
];