<?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); | |||||
} | |||||
} | |||||
}; |
return $fields; | return $fields; | ||||
} | } | ||||
public function createIndexQueryBuilder( | |||||
public function createIndexRepositoryQuery( | |||||
SearchDto $searchDto, | SearchDto $searchDto, | ||||
EntityDto $entityDto, | EntityDto $entityDto, | ||||
FieldCollection $fields, | FieldCollection $fields, | ||||
FilterCollection $filters | FilterCollection $filters | ||||
): QueryBuilder { | |||||
$queryBuilder = parent::createIndexQueryBuilder( | |||||
): RepositoryQueryInterface { | |||||
return parent::createIndexRepositoryQuery( | |||||
$searchDto, | $searchDto, | ||||
$entityDto, | $entityDto, | ||||
$fields, | $fields, | ||||
$filters | $filters | ||||
); | ); | ||||
$queryBuilder->andWhere('entity.status = ' . $searchDto->getRequest()->get('status')); | |||||
return $queryBuilder; | |||||
$repositoryQuery = parent::createIndexRepositoryQuery($searchDto, $entityDto, $fields, $filters); | |||||
if ($searchDto->getRequest()->get('status')) { | |||||
$repositoryQuery->filterByStatus($searchDto->getRequest()->get('status')); | |||||
} | |||||
return $repositoryQuery; | |||||
} | } | ||||
public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void | public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void |
<?php | |||||
namespace App\Definition\Field\IndividualData; | |||||
use Lc\PietroBundle\Definition\Field\IndividualData\IndividualDataFieldDefinition as PietroIndividualDataFieldDefinition; | |||||
class IndividualDataFieldDefinition extends PietroIndividualDataFieldDefinition | |||||
{ | |||||
public function configureIndex(): array | |||||
{ | |||||
return [ | |||||
'territory', | |||||
'nbDream', | |||||
'nbRevolt', | |||||
'nbProjectBoost', | |||||
'nbProjectInspiring', | |||||
]; | |||||
} | |||||
public function configureForm(): array | |||||
{ | |||||
return [ | |||||
'territory', | |||||
'dream', | |||||
'revolt', | |||||
'projectInspiring', | |||||
'projectBoost', | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace App\Dependency\IndividualData; | |||||
use App\Definition\Field\IndividualData\IndividualDataFieldDefinition; | |||||
use Lc\PietroBundle\Definition\Field\IndividualData\IndividualDataFieldDefinition as PietroIndividualDataFieldDefinition; | |||||
class IndividualDataDependency | |||||
{ | |||||
public function getAliases() | |||||
{ | |||||
return [ | |||||
PietroIndividualDataFieldDefinition::class => IndividualDataFieldDefinition::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); |
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | parent::__construct($repository, 'r', $paginator); | ||||
} | } | ||||
public function filterByStatus($status) | |||||
{ | |||||
$this->andWhereEqual('status', $status); | |||||
} | |||||
} | } |