Files
idpan.poznan.pl/administrator/components/com_dvtr_employees/services/provider.php
2026-02-08 21:16:11 +01:00

67 lines
2.1 KiB
PHP

<?php
/**
* @version CVS: 1.0.0
* @package Com_Dvtr_employees
* @author Pawel Potoniec <pawel@devatri.pl>
* @copyright 2025 Pawel Potoniec
*/
defined('_JEXEC') or die;
use Joomla\CMS\Categories\CategoryFactoryInterface;
use Joomla\CMS\Component\Router\RouterFactoryInterface;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\Service\Provider\CategoryFactory;
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
use Joomla\CMS\Extension\Service\Provider\RouterFactory;
use Joomla\CMS\HTML\Registry;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Dvtremployees\Component\Dvtr_employees\Administrator\Extension\Dvtr_employeesComponent;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
/**
* The Dvtr_employees service provider.
*
* @since 1.0.0
*/
return new class implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 1.0.0
*/
public function register(Container $container)
{
$container->registerServiceProvider(new CategoryFactory('\\Dvtremployees\\Component\\Dvtr_employees'));
$container->registerServiceProvider(new MVCFactory('\\Dvtremployees\\Component\\Dvtr_employees'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Dvtremployees\\Component\\Dvtr_employees'));
$container->registerServiceProvider(new RouterFactory('\\Dvtremployees\\Component\\Dvtr_employees'));
$container->set(
ComponentInterface::class,
function (Container $container)
{
$component = new Dvtr_employeesComponent($container->get(ComponentDispatcherFactoryInterface::class));
$component->setRegistry($container->get(Registry::class));
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
return $component;
}
);
}
};