@@ -0,0 +1,32 @@ | |||
<?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); | |||
} | |||
} | |||
}; |
@@ -86,22 +86,24 @@ class CollectifDataCrudController extends AbstractAdminController | |||
return $fields; | |||
} | |||
public function createIndexQueryBuilder( | |||
public function createIndexRepositoryQuery( | |||
SearchDto $searchDto, | |||
EntityDto $entityDto, | |||
FieldCollection $fields, | |||
FilterCollection $filters | |||
): QueryBuilder { | |||
$queryBuilder = parent::createIndexQueryBuilder( | |||
): RepositoryQueryInterface { | |||
return parent::createIndexRepositoryQuery( | |||
$searchDto, | |||
$entityDto, | |||
$fields, | |||
$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 |
@@ -0,0 +1,31 @@ | |||
<?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', | |||
]; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
<?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, | |||
]; | |||
} | |||
} |
@@ -18,6 +18,7 @@ class Kernel extends BaseKernel | |||
if (is_file(\dirname(__DIR__).'/config/services.yaml')) { | |||
$container->import('../config/services.yaml'); | |||
$container->import('../config/dependencies.php'); | |||
$container->import('../config/{services}_'.$this->environment.'.yaml'); | |||
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) { | |||
(require $path)($container->withPath($path), $this); |
@@ -12,4 +12,9 @@ class CollectifDataRepositoryQuery extends AbstractRepositoryQuery implements Re | |||
{ | |||
parent::__construct($repository, 'r', $paginator); | |||
} | |||
public function filterByStatus($status) | |||
{ | |||
$this->andWhereEqual('status', $status); | |||
} | |||
} |