Browse Source

bug definition

develop
Charly 3 years ago
parent
commit
27942d8d7c
6 changed files with 93 additions and 6 deletions
  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 View File

<?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 View File

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

+ 31
- 0
src/Definition/Field/IndividualData/IndividualDataFieldDefinition.php View File

<?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 View File

<?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 View File



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

+ 5
- 0
src/Repository/CollectifData/CollectifDataRepositoryQuery.php View File

{ {
parent::__construct($repository, 'r', $paginator); parent::__construct($repository, 'r', $paginator);
} }

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

Loading…
Cancel
Save