Explorar el Código

bug definition

develop
Charly hace 3 años
padre
commit
27942d8d7c
Se han modificado 6 ficheros con 93 adiciones y 6 borrados
  1. +32
    -0
      config/dependencies.php
  2. +8
    -6
      src/Controller/Admin/CollectifDataCrudController.php
  3. +31
    -0
      src/Definition/Field/IndividualData/IndividualDataFieldDefinition.php
  4. +16
    -0
      src/Dependency/IndividualData/IndividualDataDependency.php
  5. +1
    -0
      src/Kernel.php
  6. +5
    -0
      src/Repository/CollectifData/CollectifDataRepositoryQuery.php

+ 32
- 0
config/dependencies.php Ver fichero

@@ -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);
}
}

};

+ 8
- 6
src/Controller/Admin/CollectifDataCrudController.php Ver fichero

@@ -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

+ 31
- 0
src/Definition/Field/IndividualData/IndividualDataFieldDefinition.php Ver fichero

@@ -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',
];
}
}

+ 16
- 0
src/Dependency/IndividualData/IndividualDataDependency.php Ver fichero

@@ -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,
];
}
}

+ 1
- 0
src/Kernel.php Ver fichero

@@ -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);

+ 5
- 0
src/Repository/CollectifData/CollectifDataRepositoryQuery.php Ver fichero

@@ -12,4 +12,9 @@ class CollectifDataRepositoryQuery extends AbstractRepositoryQuery implements Re
{
parent::__construct($repository, 'r', $paginator);
}

public function filterByStatus($status)
{
$this->andWhereEqual('status', $status);
}
}

Cargando…
Cancelar
Guardar