<?php | |||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | |||||
return function(ContainerConfigurator $configurator) { | |||||
$services = $configurator->services(); | |||||
$baseDirectoryDependency = dirname(__FILE__).'/../src/Dependency/'; | |||||
$directoriesDenpendencyInjection = scandir($baseDirectoryDependency); | |||||
$dependencies = []; | |||||
foreach($directoriesDenpendencyInjection as $directory) { | |||||
if($directory != '.' && $directory != '..' && is_dir($baseDirectoryDependency.$directory)) { | |||||
$filesDenpendencyInjection = scandir($baseDirectoryDependency.$directory); | |||||
foreach($filesDenpendencyInjection as $file) { | |||||
if($file != '.' && $file != '..') { | |||||
$classDependency = 'App\Dependency\\'.$directory.'\\'.str_replace('.php', '', $file) ; | |||||
$dependencies[] = new $classDependency; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
foreach($dependencies as $dependency) { | |||||
$aliases = $dependency->getAliases(); | |||||
foreach($aliases as $alias => $final) { | |||||
$services->alias($alias, $final); | |||||
} | |||||
} | |||||
}; |
# please note that last definitions always *replace* previous ones | # please note that last definitions always *replace* previous ones | ||||
# Definition | # Definition | ||||
Lc\CaracoleBundle\Definition\MerchantSettingDefinition: | |||||
class: App\Definition\MerchantSettingDefinition | |||||
Lc\SovBundle\Definition\SiteSettingDefinition: | |||||
class: App\Definition\SiteSettingDefinition | |||||
#Lc\CaracoleBundle\Definition\MerchantSettingDefinition: | |||||
# class: App\Definition\MerchantSettingDefinition | |||||
#Lc\SovBundle\Definition\SiteSettingDefinition: | |||||
# class: App\Definition\SiteSettingDefinition | |||||
# Repository | # Repository | ||||
Lc\SovBundle\Repository\Reminder\ReminderRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Reminder\ReminderRepository | |||||
Lc\SovBundle\Repository\File\FileRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\File\FileRepository | |||||
Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Newsletter\NewsletterRepository | |||||
Lc\SovBundle\Repository\Setting\SiteSettingRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Setting\SiteSettingRepository | |||||
Lc\SovBundle\Repository\Site\SiteRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Site\SiteRepository | |||||
Lc\SovBundle\Repository\Site\PageRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Site\PageRepository | |||||
Lc\SovBundle\Repository\Site\NewsRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Site\NewsRepository | |||||
Lc\SovBundle\Repository\Ticket\TicketRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Ticket\TicketRepository | |||||
Lc\SovBundle\Repository\Ticket\TicketMessageRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\Ticket\TicketMessageRepository | |||||
Lc\SovBundle\Repository\User\GroupUserRepositoryInterface: | |||||
class: Lc\CaracoleBundle\Repository\User\GroupUserRepository | |||||
Lc\SovBundle\Repository\User\UserRepositoryInterface: | |||||
class: Lc\SovBundle\Repository\User\UserRepository | |||||
Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryInterface: | |||||
class: Lc\CaracoleBundle\Repository\Merchant\MerchantRepository | |||||
Lc\CaracoleBundle\Repository\User\UserMerchantRepositoryInterface: | |||||
class: Lc\CaracoleBundle\Repository\User\UserMerchantRepository | |||||
Lc\CaracoleBundle\Repository\User\VisitorRepositoryInterface: | |||||
class: Lc\CaracoleBundle\Repository\User\VisitorRepository | |||||
Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface: | |||||
class: Lc\CaracoleBundle\Repository\Section\SectionRepository | |||||
Lc\CaracoleBundle\Repository\PointSale\PointSaleRepositoryInterface: | |||||
class: Lc\CaracoleBundle\Repository\PointSale\PointSaleRepository | |||||
Lc\CaracoleBundle\Repository\Credit\CreditHistoryRepositoryInterface: | |||||
class: Lc\CaracoleBundle\Repository\Credit\CreditHistoryRepository | |||||
#Lc\SovBundle\Repository\Reminder\ReminderRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Reminder\ReminderRepository | |||||
#Lc\SovBundle\Repository\File\FileRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\File\FileRepository | |||||
#Lc\SovBundle\Repository\Newsletter\NewsletterRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Newsletter\NewsletterRepository | |||||
#Lc\SovBundle\Repository\Setting\SiteSettingRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Setting\SiteSettingRepository | |||||
#Lc\SovBundle\Repository\Site\SiteRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Site\SiteRepository | |||||
#Lc\SovBundle\Repository\Site\PageRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Site\PageRepository | |||||
#Lc\SovBundle\Repository\Site\NewsRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Site\NewsRepository | |||||
#Lc\SovBundle\Repository\Ticket\TicketRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Ticket\TicketRepository | |||||
#Lc\SovBundle\Repository\Ticket\TicketMessageRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\Ticket\TicketMessageRepository | |||||
#Lc\SovBundle\Repository\User\GroupUserRepositoryInterface: | |||||
# class: Lc\CaracoleBundle\Repository\User\GroupUserRepository | |||||
#Lc\SovBundle\Repository\User\UserRepositoryInterface: | |||||
# class: Lc\SovBundle\Repository\User\UserRepository | |||||
#Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryInterface: | |||||
# class: Lc\CaracoleBundle\Repository\Merchant\MerchantRepository | |||||
#Lc\CaracoleBundle\Repository\User\UserMerchantRepositoryInterface: | |||||
# class: Lc\CaracoleBundle\Repository\User\UserMerchantRepository | |||||
#Lc\CaracoleBundle\Repository\User\VisitorRepositoryInterface: | |||||
# class: Lc\CaracoleBundle\Repository\User\VisitorRepository | |||||
#Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface: | |||||
# class: Lc\CaracoleBundle\Repository\Section\SectionRepository | |||||
#Lc\CaracoleBundle\Repository\PointSale\PointSaleRepositoryInterface: | |||||
# class: Lc\CaracoleBundle\Repository\PointSale\PointSaleRepository | |||||
#Lc\CaracoleBundle\Repository\Credit\CreditHistoryRepositoryInterface: | |||||
# class: Lc\CaracoleBundle\Repository\Credit\CreditHistoryRepository | |||||
# Factory | # Factory | ||||
Lc\SovBundle\Factory\Reminder\ReminderFactoryInterface: | |||||
class: Lc\CaracoleBundle\Factory\Reminder\ReminderFactory | |||||
Lc\SovBundle\Factory\Ticket\TicketFactoryInterface: | |||||
class: Lc\CaracoleBundle\Factory\Ticket\TicketFactory | |||||
#Lc\SovBundle\Factory\Reminder\ReminderFactoryInterface: | |||||
# class: Lc\CaracoleBundle\Factory\Reminder\ReminderFactory | |||||
#Lc\SovBundle\Factory\Ticket\TicketFactoryInterface: | |||||
# class: Lc\CaracoleBundle\Factory\Ticket\TicketFactory |
namespace App\Command; | namespace App\Command; | ||||
use Lc\SovBundle\Repository\Reminder\ReminderRepositoryQueryInterface; | |||||
use Symfony\Component\Console\Command\Command; | use Symfony\Component\Console\Command\Command; | ||||
use Symfony\Component\Console\Input\InputArgument; | use Symfony\Component\Console\Input\InputArgument; | ||||
use Symfony\Component\Console\Input\InputInterface; | use Symfony\Component\Console\Input\InputInterface; | ||||
use Symfony\Component\Console\Input\InputOption; | use Symfony\Component\Console\Input\InputOption; | ||||
use Symfony\Component\Console\Output\OutputInterface; | use Symfony\Component\Console\Output\OutputInterface; | ||||
use Symfony\Component\Console\Style\SymfonyStyle; | |||||
use Lc\CaracoleBundle\Repository\Reminder\ReminderRepositoryQuery; | |||||
use Lc\SovBundle\Repository\Reminder\ReminderStore; | |||||
use Lc\SovBundle\Repository\Reminder\ReminderStoreInterface; | |||||
class TestCommand extends Command | class TestCommand extends Command | ||||
{ | { | ||||
protected static $defaultName = 'app:test'; | protected static $defaultName = 'app:test'; | ||||
protected static $defaultDescription = 'Add a short description for your command'; | protected static $defaultDescription = 'Add a short description for your command'; | ||||
protected ReminderRepositoryQuery $query; | |||||
protected ReminderStore $store; | |||||
protected ReminderRepositoryQueryInterface $query; | |||||
protected ReminderStoreInterface $store; | |||||
public function __construct( | public function __construct( | ||||
ReminderRepositoryQuery $query, | |||||
ReminderStore $store | |||||
) | |||||
{ | |||||
ReminderRepositoryQueryInterface $query, | |||||
ReminderStoreInterface $store | |||||
) { | |||||
$this->query = $query; | $this->query = $query; | ||||
$this->store = $store; | $this->store = $store; | ||||
protected function configure(): void | protected function configure(): void | ||||
{ | { | ||||
$this | $this | ||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description') | |||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description') | |||||
; | |||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description') | |||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description'); | |||||
} | } | ||||
protected function execute(InputInterface $input, OutputInterface $output): int | protected function execute(InputInterface $input, OutputInterface $output): int |
[ | [ | ||||
MenuItem::linkToRoute('setting_merchant', '', 'carac_admin_setting_merchant'), | MenuItem::linkToRoute('setting_merchant', '', 'carac_admin_setting_merchant'), | ||||
MenuItem::linkToRoute('setting_section', '', 'carac_admin_setting_section'), | MenuItem::linkToRoute('setting_section', '', 'carac_admin_setting_section'), | ||||
MenuItem::linkToRoute('setting_global', '', 'sov_admin_setting_global'), | |||||
MenuItem::linkToRoute('setting_global', '', 'carac_admin_setting_site'), | |||||
] | ] | ||||
); | ); | ||||
use App\Entity\Site\Page; | use App\Entity\Site\Page; | ||||
use Lc\CaracoleBundle\Controller\Site\PageAdminController as CaracPageAdminController; | use Lc\CaracoleBundle\Controller\Site\PageAdminController as CaracPageAdminController; | ||||
use Lc\SovBundle\Factory\Site\PageFactory; | |||||
class PageAdminController extends CaracPageAdminController | class PageAdminController extends CaracPageAdminController | ||||
{ | { | ||||
{ | { | ||||
return Page::class; | return Page::class; | ||||
} | } | ||||
public function getEntityFactory(): string | |||||
{ | |||||
return PageFactory::class; | |||||
} | |||||
} | } |
<?php | |||||
namespace App\Dependency\Definition; | |||||
use App\Definition\MerchantSettingDefinition; | |||||
use App\Definition\SectionSettingDefinition; | |||||
use App\Definition\SiteSettingDefinition; | |||||
use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface; | |||||
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface; | |||||
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface; | |||||
class DefinitionDependency | |||||
{ | |||||
public function getAliases() | |||||
{ | |||||
return [ | |||||
MerchantSettingDefinitionInterface::class => MerchantSettingDefinition::class, | |||||
SectionSettingDefinitionInterface::class => SectionSettingDefinition::class, | |||||
SiteSettingDefinitionInterface::class => SiteSettingDefinition::class, | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace App\Dependency\Reminder; | |||||
use App\Entity\Reminder\Reminder; | |||||
use Lc\CaracoleBundle\Factory\Reminder\ReminderFactory; | |||||
use Lc\SovBundle\Factory\Reminder\ReminderFactoryInterface; | |||||
use Lc\SovBundle\Model\Reminder\ReminderInterface; | |||||
use Lc\SovBundle\Repository\Reminder\ReminderRepositoryInterface; | |||||
use App\Repository\Reminder\ReminderRepository; | |||||
class ReminderDependency implements DependencyInterface | |||||
{ | |||||
public function getAliases() | |||||
{ | |||||
return [ | |||||
ReminderInterface::class => Reminder::class, | |||||
ReminderFactoryInterface::class => ReminderFactory::class, | |||||
ReminderRepositoryInterface::class => ReminderRepository::class, | |||||
// doctrine entity | |||||
// factory | |||||
// repository | |||||
// repository query | |||||
// store | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace App\Dependency\Reminder; | |||||
use Lc\SovBundle\Repository\Reminder\ReminderStore; | |||||
use Lc\SovBundle\Repository\Reminder\ReminderStoreInterface; | |||||
class ReminderDependency | |||||
{ | |||||
public function getAliases() | |||||
{ | |||||
return [ | |||||
//ReminderRepositoryInterface::class => ReminderRepository::class, | |||||
//ReminderRepositoryQueryInterface::class => ReminderRepositoryQuery::class, | |||||
//ReminderStoreInterface::class => ReminderStore::class, | |||||
//ReminderFactoryInterface::class => ReminderFactory::class, | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace App\Dependency\Ticket; | |||||
use Lc\CaracoleBundle\Factory\Ticket\TicketFactory; | |||||
use Lc\SovBundle\Factory\Ticket\TicketFactoryInterface; | |||||
class TicketDependency | |||||
{ | |||||
public function getAliases() | |||||
{ | |||||
return [ | |||||
TicketFactoryInterface::class => TicketFactory::class, | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace App\Dependency\Ticket; | |||||
use Lc\SovBundle\Factory\Ticket\TicketMessageFactory; | |||||
use Lc\SovBundle\Factory\Ticket\TicketMessageFactoryInterface; | |||||
class TicketMessageDependency | |||||
{ | |||||
public function getAliases() | |||||
{ | |||||
return [ | |||||
//TicketMessageFactoryInterface::class => TicketMessageFactory::class, | |||||
]; | |||||
} | |||||
} |
if (is_file(\dirname(__DIR__).'/config/services.yaml')) { | if (is_file(\dirname(__DIR__).'/config/services.yaml')) { | ||||
$container->import('../config/services.yaml'); | $container->import('../config/services.yaml'); | ||||
$container->import('../config/dependencies.php'); | |||||
$container->import('../config/{services}_'.$this->environment.'.yaml'); | $container->import('../config/{services}_'.$this->environment.'.yaml'); | ||||
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) { | } elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) { | ||||
(require $path)($container->withPath($path), $this); | (require $path)($container->withPath($path), $this); |