This repository has been archived on 2024-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
joomla/bin/component_parts/provider.sh

34 lines
1.2 KiB
Bash
Raw Normal View History

2023-06-01 08:20:10 -07:00
#!/bin/bash
cat <<EOM > admin/services/provider.php
<?php defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\MVCComponent;
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
return new class implements ServiceProviderInterface {
public function register(Container \$container): void {
2023-06-06 01:58:54 -07:00
\$container->registerServiceProvider(new MVCFactory('\\\\Harvst\\\\Component\\\\${name^}'));
\$container->registerServiceProvider(new ComponentDispatcherFactory('\\\\Harvst\\\\Component\\\\${name^}'));
2023-06-01 08:20:10 -07:00
\$container->set(
ComponentInterface::class,
function (Container \$container) {
\$component = new MVCComponent(\$container->get(ComponentDispatcherFactoryInterface::class));
\$component->setMVCFactory(\$container->get(MVCFactoryInterface::class));
return \$component;
}
);
}
};
EOM