Quellcode durchsuchen

Merge branch 'develop'

master
Guillaume vor 2 Jahren
Ursprung
Commit
429db68b8a
78 geänderte Dateien mit 2802 neuen und 4 gelöschten Zeilen
  1. +39
    -0
      Container/Dream/DreamContainer.php
  2. +48
    -0
      Container/IndividualData/IndividualDataContainer.php
  3. +39
    -0
      Container/ProjectBoost/ProjectBoostContainer.php
  4. +39
    -0
      Container/ProjectInspiring/ProjectInspiringContainer.php
  5. +39
    -0
      Container/Revolt/RevoltContainer.php
  6. +39
    -0
      Container/Subthematic/SubthematicContainer.php
  7. +39
    -0
      Container/Territory/TerritoryContainer.php
  8. +39
    -0
      Container/Thematic/ThematicContainer.php
  9. +10
    -0
      Controller/AbstractAdminController.php
  10. +10
    -0
      Controller/AbstractController.php
  11. +72
    -0
      Controller/ControllerTrait.php
  12. +147
    -0
      Controller/IndividualData/IndividualDataAdminController.php
  13. +26
    -0
      Controller/Subthematic/SubthematicAdminController.php
  14. +23
    -0
      Controller/Territory/TerritoryAdminController.php
  15. +22
    -0
      Controller/Thematic/ThematicAdminController.php
  16. +93
    -0
      Definition/Field/IndividualData/IndividualDataFieldDefinition.php
  17. +0
    -0
      DependencyInjection/Configuration.php
  18. +0
    -0
      DependencyInjection/LcPietroExtension.php
  19. +8
    -0
      Doctrine/Extension/DescriptionProjectInterface.php
  20. +63
    -0
      Doctrine/Extension/DescriptionProjectTrait.php
  21. +17
    -0
      Factory/Dream/DreamFactory.php
  22. +17
    -0
      Factory/IndividualData/IndividualDataFactory.php
  23. +17
    -0
      Factory/ProjectBoost/ProjectBoostFactory.php
  24. +17
    -0
      Factory/ProjectInspiring/ProjectInspiringFactory.php
  25. +17
    -0
      Factory/Revolt/RevoltFactory.php
  26. +17
    -0
      Factory/Subthematic/SubthematicFactory.php
  27. +17
    -0
      Factory/Territory/TerritoryFactory.php
  28. +17
    -0
      Factory/Thematic/ThematicFactory.php
  29. +103
    -0
      Form/Dream/DreamType.php
  30. +94
    -0
      Form/ProjectBoost/ProjectBoostType.php
  31. +104
    -0
      Form/ProjectInspiring/ProjectInspiringType.php
  32. +95
    -0
      Form/Revolt/RevoltType.php
  33. +4
    -4
      LcPietroBundle.php
  34. +44
    -0
      Model/AbstractData.php
  35. +41
    -0
      Model/Dream/Dream.php
  36. +8
    -0
      Model/Dream/DreamInterface.php
  37. +302
    -0
      Model/IndividualData/IndividualData.php
  38. +8
    -0
      Model/IndividualData/IndividualDataInterface.php
  39. +39
    -0
      Model/ProjectBoost/ProjectBoost.php
  40. +8
    -0
      Model/ProjectBoost/ProjectBoostInterface.php
  41. +40
    -0
      Model/ProjectInspiring/ProjectInspiring.php
  42. +8
    -0
      Model/ProjectInspiring/ProjectInspiringInterface.php
  43. +40
    -0
      Model/Revolt/Revolt.php
  44. +8
    -0
      Model/Revolt/RevoltInterface.php
  45. +52
    -0
      Model/Subthematic/Subthematic.php
  46. +8
    -0
      Model/Subthematic/SubthematicInterface.php
  47. +94
    -0
      Model/Territory/Territory.php
  48. +8
    -0
      Model/Territory/TerritoryInterface.php
  49. +79
    -0
      Model/Thematic/Thematic.php
  50. +8
    -0
      Model/Thematic/ThematicInterface.php
  51. +15
    -0
      Repository/Dream/DreamRepository.php
  52. +14
    -0
      Repository/Dream/DreamRepositoryQuery.php
  53. +15
    -0
      Repository/Dream/DreamStore.php
  54. +15
    -0
      Repository/IndividualData/IndividualDataRepository.php
  55. +20
    -0
      Repository/IndividualData/IndividualDataRepositoryQuery.php
  56. +33
    -0
      Repository/IndividualData/IndividualDataStore.php
  57. +15
    -0
      Repository/ProjectBoost/ProjectBoostRepository.php
  58. +14
    -0
      Repository/ProjectBoost/ProjectBoostRepositoryQuery.php
  59. +16
    -0
      Repository/ProjectBoost/ProjectBoostStore.php
  60. +15
    -0
      Repository/ProjectInspiring/ProjectInspiringRepository.php
  61. +14
    -0
      Repository/ProjectInspiring/ProjectInspiringRepositoryQuery.php
  62. +15
    -0
      Repository/ProjectInspiring/ProjectInspiringStore.php
  63. +15
    -0
      Repository/Revolt/RevoltRepository.php
  64. +14
    -0
      Repository/Revolt/RevoltRepositoryQuery.php
  65. +15
    -0
      Repository/Revolt/RevoltStore.php
  66. +96
    -0
      Repository/Search/SearchRepositoryQuery.php
  67. +66
    -0
      Repository/Search/SearchStore.php
  68. +15
    -0
      Repository/Subthematic/SubthematicRepository.php
  69. +15
    -0
      Repository/Subthematic/SubthematicRepositoryQuery.php
  70. +34
    -0
      Repository/Subthematic/SubthematicStore.php
  71. +15
    -0
      Repository/Territory/TerritoryRepository.php
  72. +15
    -0
      Repository/Territory/TerritoryRepositoryQuery.php
  73. +34
    -0
      Repository/Territory/TerritoryStore.php
  74. +15
    -0
      Repository/Thematic/ThematicRepository.php
  75. +15
    -0
      Repository/Thematic/ThematicRepositoryQuery.php
  76. +33
    -0
      Repository/Thematic/ThematicStore.php
  77. +16
    -0
      Resources/config/services.yaml
  78. +62
    -0
      Resources/translations/admin.fr.yaml

+ 39
- 0
Container/Dream/DreamContainer.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Container\Dream;

use Lc\PietroBundle\Factory\Dream\DreamFactory;
use Lc\PietroBundle\Repository\Dream\DreamRepositoryQuery;
use Lc\PietroBundle\Repository\Dream\DreamStore;

class DreamContainer
{
protected DreamFactory $factory;
protected DreamRepositoryQuery $repositoryQuery;
protected DreamStore $store;

public function __construct(
DreamFactory $factory,
DreamRepositoryQuery $repositoryQuery,
DreamStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): DreamFactory
{
return $this->factory;
}

public function getRepositoryQuery(): DreamRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): DreamStore
{
return $this->store;
}
}

+ 48
- 0
Container/IndividualData/IndividualDataContainer.php Datei anzeigen

@@ -0,0 +1,48 @@
<?php

namespace Lc\PietroBundle\Container\IndividualData;

use Lc\PietroBundle\Definition\Field\IndividualData\IndividualDataFieldDefinition;
use Lc\PietroBundle\Factory\IndividualData\IndividualDataFactory;
use Lc\PietroBundle\Repository\IndividualData\IndividualDataRepositoryQuery;
use Lc\PietroBundle\Repository\IndividualData\IndividualDataStore;

class IndividualDataContainer
{
protected IndividualDataFactory $factory;
protected IndividualDataRepositoryQuery $repositoryQuery;
protected IndividualDataStore $store;
protected IndividualDataFieldDefinition $fieldDefinition;

public function __construct(
IndividualDataFactory $factory,
IndividualDataRepositoryQuery $repositoryQuery,
IndividualDataStore $store,
IndividualDataFieldDefinition $fieldDefinition
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
$this->fieldDefinition = $fieldDefinition;
}

public function getFactory(): IndividualDataFactory
{
return $this->factory;
}

public function getRepositoryQuery(): IndividualDataRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): IndividualDataStore
{
return $this->store;
}

public function getFieldDefinition(): IndividualDataFieldDefinition
{
return $this->fieldDefinition;
}
}

+ 39
- 0
Container/ProjectBoost/ProjectBoostContainer.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Container\ProjectBoost;

use Lc\PietroBundle\Factory\ProjectBoost\ProjectBoostFactory;
use Lc\PietroBundle\Repository\ProjectBoost\ProjectBoostRepositoryQuery;
use Lc\PietroBundle\Repository\ProjectBoost\ProjectBoostStore;

class ProjectBoostContainer
{
protected ProjectBoostFactory $factory;
protected ProjectBoostRepositoryQuery $repositoryQuery;
protected ProjectBoostStore $store;

public function __construct(
ProjectBoostFactory $factory,
ProjectBoostRepositoryQuery $repositoryQuery,
ProjectBoostStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): ProjectBoostFactory
{
return $this->factory;
}

public function getRepositoryQuery(): ProjectBoostRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): ProjectBoostStore
{
return $this->store;
}
}

+ 39
- 0
Container/ProjectInspiring/ProjectInspiringContainer.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Container\ProjectInspiring;

use Lc\PietroBundle\Factory\ProjectInspiring\ProjectInspiringFactory;
use Lc\PietroBundle\Repository\ProjectInspiring\ProjectInspiringRepositoryQuery;
use Lc\PietroBundle\Repository\ProjectInspiring\ProjectInspiringStore;

class ProjectInspiringContainer
{
protected ProjectInspiringFactory $factory;
protected ProjectInspiringRepositoryQuery $repositoryQuery;
protected ProjectInspiringStore $store;

public function __construct(
ProjectInspiringFactory $factory,
ProjectInspiringRepositoryQuery $repositoryQuery,
ProjectInspiringStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): ProjectInspiringFactory
{
return $this->factory;
}

public function getRepositoryQuery(): ProjectInspiringRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): ProjectInspiringStore
{
return $this->store;
}
}

+ 39
- 0
Container/Revolt/RevoltContainer.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Container\Revolt;

use Lc\PietroBundle\Factory\Revolt\RevoltFactory;
use Lc\PietroBundle\Repository\Revolt\RevoltRepositoryQuery;
use Lc\PietroBundle\Repository\Revolt\RevoltStore;

class RevoltContainer
{
protected RevoltFactory $factory;
protected RevoltRepositoryQuery $repositoryQuery;
protected RevoltStore $store;

public function __construct(
RevoltFactory $factory,
RevoltRepositoryQuery $repositoryQuery,
RevoltStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): RevoltFactory
{
return $this->factory;
}

public function getRepositoryQuery(): RevoltRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): RevoltStore
{
return $this->store;
}
}

+ 39
- 0
Container/Subthematic/SubthematicContainer.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Container\Subthematic;

use Lc\PietroBundle\Factory\Subthematic\SubthematicFactory;
use Lc\PietroBundle\Repository\Subthematic\SubthematicRepositoryQuery;
use Lc\PietroBundle\Repository\Subthematic\SubthematicStore;

class SubthematicContainer
{
protected SubthematicFactory $factory;
protected SubthematicRepositoryQuery $repositoryQuery;
protected SubthematicStore $store;

public function __construct(
SubthematicFactory $factory,
SubthematicRepositoryQuery $repositoryQuery,
SubthematicStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): SubthematicFactory
{
return $this->factory;
}

public function getRepositoryQuery(): SubthematicRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): SubthematicStore
{
return $this->store;
}
}

+ 39
- 0
Container/Territory/TerritoryContainer.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Container\Territory;

use Lc\PietroBundle\Factory\Territory\TerritoryFactory;
use Lc\PietroBundle\Repository\Territory\TerritoryRepositoryQuery;
use Lc\PietroBundle\Repository\Territory\TerritoryStore;

class TerritoryContainer
{
protected TerritoryFactory $factory;
protected TerritoryRepositoryQuery $repositoryQuery;
protected TerritoryStore $store;

public function __construct(
TerritoryFactory $factory,
TerritoryRepositoryQuery $repositoryQuery,
TerritoryStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): TerritoryFactory
{
return $this->factory;
}

public function getRepositoryQuery(): TerritoryRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): TerritoryStore
{
return $this->store;
}
}

+ 39
- 0
Container/Thematic/ThematicContainer.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Container\Thematic;

use Lc\PietroBundle\Factory\Thematic\ThematicFactory;
use Lc\PietroBundle\Repository\Thematic\ThematicRepositoryQuery;
use Lc\PietroBundle\Repository\Thematic\ThematicStore;

class ThematicContainer
{
protected ThematicFactory $factory;
protected ThematicRepositoryQuery $repositoryQuery;
protected ThematicStore $store;

public function __construct(
ThematicFactory $factory,
ThematicRepositoryQuery $repositoryQuery,
ThematicStore $store
) {
$this->factory = $factory;
$this->repositoryQuery = $repositoryQuery;
$this->store = $store;
}

public function getFactory(): ThematicFactory
{
return $this->factory;
}

public function getRepositoryQuery(): ThematicRepositoryQuery
{
return $this->repositoryQuery;
}

public function getStore(): ThematicStore
{
return $this->store;
}
}

+ 10
- 0
Controller/AbstractAdminController.php Datei anzeigen

@@ -0,0 +1,10 @@
<?php

namespace Lc\PietroBundle\Controller;

use Lc\SovBundle\Controller\AbstractAdminController as SovAbstractAdminController;

abstract class AbstractAdminController extends SovAbstractAdminController
{
use ControllerTrait;
}

+ 10
- 0
Controller/AbstractController.php Datei anzeigen

@@ -0,0 +1,10 @@
<?php

namespace Lc\PietroBundle\Controller;

use Lc\SovBundle\Controller\AbstractController as SovAbstractController;

abstract class AbstractController extends SovAbstractController
{
use ControllerTrait;
}

+ 72
- 0
Controller/ControllerTrait.php Datei anzeigen

@@ -0,0 +1,72 @@
<?php

namespace Lc\PietroBundle\Controller;

use Lc\PietroBundle\Container\Dream\DreamContainer;
use Lc\PietroBundle\Container\IndividualData\IndividualDataContainer;
use Lc\PietroBundle\Container\ProjectBoost\ProjectBoostContainer;
use Lc\PietroBundle\Container\ProjectInspiring\ProjectInspiringContainer;
use Lc\PietroBundle\Container\Revolt\RevoltContainer;
use Lc\PietroBundle\Container\Subthematic\SubthematicContainer;
use Lc\PietroBundle\Container\Territory\TerritoryContainer;
use Lc\PietroBundle\Container\Thematic\ThematicContainer;

trait ControllerTrait
{
public static function getSubscribedServices()
{
return array_merge(
parent::getSubscribedServices(),
[
DreamContainer::class => DreamContainer::class,
IndividualDataContainer::class => IndividualDataContainer::class,
ProjectBoostContainer::class => ProjectBoostContainer::class,
ProjectInspiringContainer::class => ProjectInspiringContainer::class,
RevoltContainer::class => RevoltContainer::class,
SubthematicContainer::class => SubthematicContainer::class,
TerritoryContainer::class => TerritoryContainer::class,
ThematicContainer::class => ThematicContainer::class,
]
);
}

public function getDreamContainer(): DreamContainer
{
return $this->get(DreamContainer::class);
}

public function getIndividualDataContainer(): IndividualDataContainer
{
return $this->get(IndividualDataContainer::class);
}

public function getProjectBoostContainer(): ProjectBoostContainer
{
return $this->get(ProjectBoostContainer::class);
}

public function getProjectInspiringContainer(): ProjectInspiringContainer
{
return $this->get(ProjectInspiringContainer::class);
}

public function getRevoltContainer(): RevoltContainer
{
return $this->get(RevoltContainer::class);
}

public function getSubthematicContainer(): SubthematicContainer
{
return $this->get(SubthematicContainer::class);
}

public function getTerritoryContainer(): TerritoryContainer
{
return $this->get(TerritoryContainer::class);
}

public function getThematicContainer(): ThematicContainer
{
return $this->get(ThematicContainer::class);
}
}

+ 147
- 0
Controller/IndividualData/IndividualDataAdminController.php Datei anzeigen

@@ -0,0 +1,147 @@
<?php

namespace Lc\PietroBundle\Controller\IndividualData;

use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use Lc\PietroBundle\Repository\Dream\DreamStore;
use Lc\PietroBundle\Repository\ProjectBoost\ProjectBoostStore;
use Lc\PietroBundle\Repository\ProjectInspiring\ProjectInspiringStore;
use Lc\PietroBundle\Repository\Revolt\RevoltStore;
use Lc\PietroBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Request;
use Lc\SovBundle\Generator\CsvGenerator;

abstract class IndividualDataAdminController extends AbstractAdminController
{
protected DreamStore $dreamStore;
protected RevoltStore $revoltStore;
protected ProjectBoostStore $projectBoostStore;
protected ProjectInspiringStore $projectInspiringStore;

public function __construct(
DreamStore $dreamStore,
RevoltStore $revoltStore,
ProjectBoostStore $projectBoostStore,
ProjectInspiringStore $projectInspiringStore
) {
$this->dreamStore = $dreamStore;
$this->revoltStore = $revoltStore;
$this->projectBoostStore = $projectBoostStore;
$this->projectInspiringStore = $projectInspiringStore;
}

public function createEntity(string $entityFqcn)
{
return $this->getIndividualDataContainer()->getFactory()->create();
}

public function configureFields(string $pageName): iterable
{
return $this->getIndividualDataContainer()
->getFieldDefinition()
->getFields($pageName);
}

public function getRepositoryQuery(): RepositoryQueryInterface
{
return $this->getIndividualDataContainer()->getRepositoryQuery();
}

public function createIndexRepositoryQuery(
SearchDto $searchDto,
EntityDto $entityDto,
FieldCollection $fields,
FilterCollection $filters
): RepositoryQueryInterface {
$repositoryQuery = parent::createIndexRepositoryQuery($searchDto, $entityDto, $fields, $filters);
$status = $searchDto->getRequest()->get('status');
if ($status || $status === 0) {
$repositoryQuery->filterByStatus($searchDto->getRequest()->get('status'));
}
return $repositoryQuery;
}

public function configureActions(Actions $actions): Actions
{
parent::configureActions($actions);

$export = Action::new('export', 'actions.export')
->setIcon('fa fa-download')
->linkToCrudAction('exportCsv')
->setCssClass('btn btn-sm btn-primary export-csv')
->createAsGlobalAction();

return $actions->add(Crud::PAGE_INDEX, $export);
}

public function exportCsv(Request $request)
{
$csv = new CsvGenerator();
$csv->enableConvertEncoding('ISO-8859-1');
$csv->setTitle('Export_Liste_Individuel', true);

$columns = [
'category' => 'Catégorie',
'thematic' => 'Thématique',
'subthematic' => 'Contribution',
'territory' => 'Lieu',
'description' => 'Description'
];
$csv->setColumns($columns);

$resultArray = $this->generateAllResultArray();

$csv = $this->generateCsvData($csv, $resultArray);

return $csv->getReponse();
}

private function generateAllResultArray(): array
{
$dreamArray = $this->dreamStore->get();
$revoltArray = $this->revoltStore->get();
$projectBoostArray = $this->projectBoostStore->get();
$projectInspiringArray = $this->projectInspiringStore->get();

return array_merge($dreamArray, $revoltArray, $projectBoostArray, $projectInspiringArray);
}

private function generateCsvData($csv, $resultArray)
{
foreach ($resultArray as $result) {
$territory = $subthematic = $thematic = "";
if ($result->getIndividualData()) {
$territory = $result->getIndividualData()->getTerritory()->getName();


if ($result->getSubthematic()) {
$subthematic = $result->getSubthematic()->getName();
}

if ($result->getThematic()) {
$thematic = $result->getThematic()->getName();
}

$data = [
'category' => $result->__toString(),
'thematic' => $thematic,
'subthematic' => $subthematic,
'territory' => $territory,
'description' => $result->getDescription()
];

$csv->row($data);
}
}

return $csv;
}
}

+ 26
- 0
Controller/Subthematic/SubthematicAdminController.php Datei anzeigen

@@ -0,0 +1,26 @@
<?php

namespace Lc\PietroBundle\Controller\Subthematic;

use Lc\PietroBundle\Container\Subthematic\SubthematicContainer;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\PietroBundle\Controller\AbstractAdminController;

abstract class SubthematicAdminController extends AbstractAdminController
{
public function createEntity(string $entityFqcn)
{
return $this->getSubthematicContainer()->getFactory()->create();
}

public function configureFields(string $pageName): iterable
{
return [
TextField::new('name'),
AssociationField::new('thematic')
->setTemplatePath('crud/field/association.html.twig')
];
}

}

+ 23
- 0
Controller/Territory/TerritoryAdminController.php Datei anzeigen

@@ -0,0 +1,23 @@
<?php

namespace Lc\PietroBundle\Controller\Territory;

use Lc\PietroBundle\Container\Territory\TerritoryContainer;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\PietroBundle\Controller\AbstractAdminController;

abstract class TerritoryAdminController extends AbstractAdminController
{
public function createEntity(string $entityFqcn)
{
return $this->getTerritoryContainer()->getFactory()->create();
}

public function configureFields(string $pageName): iterable
{
return [
TextField::new('devAlias'),
TextField::new('name'),
];
}
}

+ 22
- 0
Controller/Thematic/ThematicAdminController.php Datei anzeigen

@@ -0,0 +1,22 @@
<?php

namespace Lc\PietroBundle\Controller\Thematic;

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\PietroBundle\Controller\AbstractAdminController;

abstract class ThematicAdminController extends AbstractAdminController
{
public function createEntity(string $entityFqcn)
{
return $this->getThematicContainer()->getFactory()->create();
}

public function configureFields(string $pageName): iterable
{
return [
TextField::new('name')
];
}

}

+ 93
- 0
Definition/Field/IndividualData/IndividualDataFieldDefinition.php Datei anzeigen

@@ -0,0 +1,93 @@
<?php

namespace Lc\PietroBundle\Definition\Field\IndividualData;

use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\PietroBundle\Controller\IndividualData\IndividualDataAdminController;
use Lc\PietroBundle\Form\Dream\DreamType;
use Lc\PietroBundle\Form\ProjectBoost\ProjectBoostType;
use Lc\PietroBundle\Form\ProjectInspiring\ProjectInspiringType;
use Lc\PietroBundle\Form\Revolt\RevoltType;
use Lc\PietroBundle\Repository\Territory\TerritoryStore;
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;

class IndividualDataFieldDefinition extends AbstractFieldDefinition
{

protected AuthorizationCheckerInterface $authorizationChecker;
protected TerritoryStore $territoryStore;

public function __construct(TranslatorAdmin $translatorAdmin, AuthorizationCheckerInterface $authorizationChecker, TerritoryStore $territoryStore)
{
$this->authorizationChecker = $authorizationChecker;
$this->territoryStore = $territoryStore;

parent::__construct($translatorAdmin);
}

public function configureIndex(): array
{
return [
'firstname',
'lastname',
'territory',
'nbDream',
'nbRevolt',
'nbProjectBoost',
'nbProjectInspiring',
];
}

public function configureFields(): array
{
$fields = array();

$territoryArray = $this->territoryStore->get();

$fields['firstname'] = TextField::new('firstname');
$fields['lastname'] = TextField::new('lastname');
$fields['email'] = EmailField::new('email');
$fields['territory'] = AssociationField::new('territory')->setFormTypeOption('choices', $territoryArray);
$fields['nbDream'] = TextField::new('nbDream');
$fields['nbRevolt'] = TextField::new('nbRevolt');
$fields['nbProjectBoost'] = TextField::new('nbProjectBoost');
$fields['nbProjectInspiring'] = TextField::new('nbProjectInspiring');
$fields['revolt'] = CollectionField::new('revolt')
->setFormTypeOption('entry_type', RevoltType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$fields['dream'] = CollectionField::new('dream')
->setFormTypeOption('entry_type', DreamType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$fields['projectBoost'] = CollectionField::new('projectBoost')
->setFormTypeOption('entry_type', ProjectBoostType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$fields['projectInspiring'] = CollectionField::new('projectinspiring')
->setFormTypeOption('entry_type', ProjectInspiringType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$hasAccess = $this->authorizationChecker->isGranted('ROLE_ADMIN');
if ($hasAccess) {
$fields['status'] = StatusField::new('status')
->setFormTypeOption('data', 0)
->setFormTypeOption('choices', ['Validé' => 1, 'En attente' => 0])
->setCustomOption('toggle_label', 'Valider');
} else {
$fields['status'] = HiddenField::new('status')
->setFormTypeOption('data', 0);
}


return $fields;
}

}

+ 0
- 0
DependencyInjection/Configuration.php Datei anzeigen


+ 0
- 0
DependencyInjection/LcPietroExtension.php Datei anzeigen


+ 8
- 0
Doctrine/Extension/DescriptionProjectInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Doctrine\Extension;

interface DescriptionProjectInterface
{

}

+ 63
- 0
Doctrine/Extension/DescriptionProjectTrait.php Datei anzeigen

@@ -0,0 +1,63 @@
<?php

namespace Lc\PietroBundle\Doctrine\Extension;

use Lc\PietroBundle\Model\Thematic\ThematicInterface;
use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;
use Doctrine\ORM\Mapping as ORM;

trait DescriptionProjectTrait
{

/**
* @ORM\Column(type="text")
*/
protected $description;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Thematic\ThematicInterface")
*/
protected $thematic;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Subthematic\SubthematicInterface")
*/
protected $subthematic;

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(string $description): self
{
$this->description = $description;

return $this;
}

public function getThematic(): ?ThematicInterface
{
return $this->thematic;
}

public function setThematic(?ThematicInterface $thematic): self
{
$this->thematic = $thematic;

return $this;
}

public function getSubthematic(): ?SubthematicInterface
{
return $this->subthematic;
}

public function setSubthematic(?SubthematicInterface $subthematic): self
{
$this->subthematic = $subthematic;

return $this;
}

}

+ 17
- 0
Factory/Dream/DreamFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\Dream;

use App\Entity\Dream\Dream;
use Lc\PietroBundle\Model\Dream\DreamInterface;

class DreamFactory
{
public function create(): DreamInterface
{
$dream = new Dream();

return $dream;
}

}

+ 17
- 0
Factory/IndividualData/IndividualDataFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\IndividualData;

use App\Entity\IndividualData\IndividualData;
use Lc\PietroBundle\Model\IndividualData\IndividualDataInterface;

class IndividualDataFactory
{
public function create(): IndividualDataInterface
{
$individualData = new IndividualData();

return $individualData;
}

}

+ 17
- 0
Factory/ProjectBoost/ProjectBoostFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\ProjectBoost;

use App\Entity\ProjectBoost\ProjectBoost;
use Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface;

class ProjectBoostFactory
{
public function create(): ProjectBoostInterface
{
$projectBoost = new ProjectBoost();

return $projectBoost;
}

}

+ 17
- 0
Factory/ProjectInspiring/ProjectInspiringFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\ProjectInspiring;

use App\Entity\ProjectInspiring\ProjectInspiring;
use Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface;

class ProjectInspiringFactory
{
public function create(): ProjectInspiringInterface
{
$projectInspiring = new ProjectInspiring();

return $projectInspiring;
}

}

+ 17
- 0
Factory/Revolt/RevoltFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\Revolt;

use App\Entity\Revolt\Revolt;
use Lc\PietroBundle\Model\Revolt\RevoltInterface;

class RevoltFactory
{
public function create(): RevoltInterface
{
$revolt = new Revolt();

return $revolt;
}

}

+ 17
- 0
Factory/Subthematic/SubthematicFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\Subthematic;

use App\Entity\Thematic\Subthematic;
use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;

class SubthematicFactory
{
public function create(): SubthematicInterface
{
$subthematic = new Subthematic();

return $subthematic;
}

}

+ 17
- 0
Factory/Territory/TerritoryFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\Territory;

use App\Entity\Territory\Territory;
use Lc\PietroBundle\Model\Territory\TerritoryInterface;

class TerritoryFactory
{
public function create(): TerritoryInterface
{
$territory = new Territory();

return $territory;
}

}

+ 17
- 0
Factory/Thematic/ThematicFactory.php Datei anzeigen

@@ -0,0 +1,17 @@
<?php

namespace Lc\PietroBundle\Factory\Thematic;

use App\Entity\Thematic\Thematic;
use Lc\PietroBundle\Model\Thematic\ThematicInterface;

class ThematicFactory
{
public function create(): ThematicInterface
{
$thematic = new Thematic();

return $thematic;
}

}

+ 103
- 0
Form/Dream/DreamType.php Datei anzeigen

@@ -0,0 +1,103 @@
<?php

namespace Lc\PietroBundle\Form\Dream;

use Lc\PietroBundle\Model\Dream\DreamInterface;
use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;
use Lc\PietroBundle\Model\Thematic\ThematicInterface;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;

class DreamType extends AbstractType
{

protected $em;
protected $translatorAdmin;

public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
{
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$placeholder = "";
if (isset($options['placeholder_description'])) {
$placeholder = $options['placeholder_description'];
}

$builder->add(
'description',
TextareaType::class,
[
'label' => 'form.field.dream.description',
'constraints' => [
new NotBlank(),
],
'attr' => [
"placeholder" => $placeholder
]
]
);
if ($options['thematic'] == true) {
$builder->add(
'thematic',
EntityType::class,
[
'label' => 'form.field.dream.thematic',
'class' => $this->em->getEntityName(ThematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($value)];
},
'attr' => [
'class' => 'theme'
]
]
);
}
if ($options['context'] == "backend" && $options['thematic'] == true) {
$builder->add(
'subthematic',
EntityType::class,
[
'label' => 'form.field.dream.subthematic',
'class' => $this->em->getEntityName(SubthematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($choice->getThematic()->getId())];
},
'attr' => [
'class' => 'subtheme'
]
]
);
}
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'data_class' => $this->em->getEntityName(DreamInterface::class),
'context' => 'backend',
'thematic' => true,
'placeholder_description' => false
]
);
}
}


+ 94
- 0
Form/ProjectBoost/ProjectBoostType.php Datei anzeigen

@@ -0,0 +1,94 @@
<?php

namespace Lc\PietroBundle\Form\ProjectBoost;

use Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface;
use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;
use Lc\PietroBundle\Model\Thematic\ThematicInterface;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;

class ProjectBoostType extends AbstractType
{

protected $em;
protected $translatorAdmin;

public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
{
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add(
'description',
TextareaType::class,
[
'label' => 'form.field.projectBoost.description',
'constraints' => [
new NotBlank(),
],
]
);
if ($options['thematic'] == true) {
$builder->add(
'thematic',
EntityType::class,
[
'label' => 'form.field.projectBoost.thematic',
'class' => $this->em->getEntityName(ThematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($value)];
},
'attr' => [
'class' => 'theme'
]
]
);
}
if ($options['context'] == "backend" && $options['thematic'] == true) {
$builder->add(
'subthematic',
EntityType::class,
[
'label' => 'form.field.projectBoost.subthematic',
'class' => $this->em->getEntityName(SubthematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($choice->getThematic()->getId())];
},
'attr' => [
'class' => 'subtheme'
]
]
);
}
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'data_class' => $this->em->getEntityName(ProjectBoostInterface::class),
'context' => 'backend',
'thematic' => true,
]
);
}
}


+ 104
- 0
Form/ProjectInspiring/ProjectInspiringType.php Datei anzeigen

@@ -0,0 +1,104 @@
<?php

namespace Lc\PietroBundle\Form\ProjectInspiring;

use Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface;
use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;
use Lc\PietroBundle\Model\Thematic\ThematicInterface;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;

class ProjectInspiringType extends AbstractType
{

protected $em;
protected $translatorAdmin;

public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
{
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$placeholder = "";
if (isset($options['placeholder_description'])) {
$placeholder = $options['placeholder_description'];
}

$builder->add(
'description',
TextareaType::class,
[
'label' => 'form.field.projectinspiring.description',
'constraints' => [
new NotBlank(),
],
'attr' => [
"placeholder" => $placeholder
]
]
);

if ($options['thematic'] == true) {
$builder->add(
'thematic',
EntityType::class,
[
'label' => 'form.field.projectinspiring.thematic',
'class' => $this->em->getEntityName(ThematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($value)];
},
'attr' => [
'class' => 'theme'
]
]
);
}
if ($options['context'] == "backend" && $options['thematic'] == true) {
$builder->add(
'subthematic',
EntityType::class,
[
'label' => 'form.field.projectinspiring.subthematic',
'class' => $this->em->getEntityName(SubthematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($choice->getThematic()->getId())];
},
'attr' => [
'class' => 'subtheme'
]
]
);
}
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'data_class' => $this->em->getEntityName(ProjectInspiringInterface::class),
'context' => 'backend',
'thematic' => true,
'placeholder_description' => false
]
);
}
}


+ 95
- 0
Form/Revolt/RevoltType.php Datei anzeigen

@@ -0,0 +1,95 @@
<?php

namespace Lc\PietroBundle\Form\Revolt;

use Lc\PietroBundle\Model\Revolt\RevoltInterface;
use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;
use Lc\PietroBundle\Model\Thematic\ThematicInterface;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;

class RevoltType extends AbstractType
{

protected $em;
protected $translatorAdmin;

public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
{
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add(
'description',
TextareaType::class,
[
'label' => 'form.field.revolt.description',
'constraints' => [
new NotBlank(),
],
]
);
if ($options['thematic'] == true) {
$builder->add(
'thematic',
EntityType::class,
[
'label' => 'form.field.revolt.thematic',
'class' => $this->em->getEntityName(ThematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($value)];
},
'attr' => [
'class' => 'theme'
]
]
);
}
if ($options['context'] == "backend" && $options['thematic'] == true) {
$builder->add(
'subthematic',
EntityType::class,
[
'label' => 'form.field.revolt.subthematic',
'class' => $this->em->getEntityName(SubthematicInterface::class),
'required' => false,
'choice_attr' => function ($choice, $key, $value) {
return ['data-class' => 'theme' . strtolower($choice->getThematic()->getId())];
},
'attr' => [
'class' => 'subtheme'
]
]
);
}
}

/**
* {@inheritdoc}
*/
public function configureOptions(
OptionsResolver $resolver
) {
$resolver->setDefaults(
[
'data_class' => $this->em->getEntityName(RevoltInterface::class),
'context' => 'backend',
'thematic' => true
]
);
}
}


+ 4
- 4
LcPietroBundle.php Datei anzeigen

@@ -7,8 +7,8 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;

class LcPietroBundle extends Bundle
{
public function getContainerExtension()
{
return new LcPietroExtension();
}
public function getContainerExtension()
{
return new LcPietroExtension();
}
}

+ 44
- 0
Model/AbstractData.php Datei anzeigen

@@ -0,0 +1,44 @@
<?php

namespace Lc\PietroBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class AbstractData implements StatusInterface, EntityInterface
{
use StatusTrait;

const TERRITORY = "Territory";
const CATEGORY_REVOLT = "Revolt";
const CATEGORY_DREAM = "Dream";
const CATEGORY_PROJECTBOOST = "ProjectBoost";
const CATEGORY_PROJECTINSPIRING = "ProjectInspiring";

const CATEGORY_LABEL_REVOLT = "Nos révoltes";
const CATEGORY_LABEL_DREAM = "Nos rêves";
const CATEGORY_LABEL_PROJECTBOOST = "Les actions à booster";
const CATEGORY_LABEL_PROJECTINSPIRING = "Les actions inspirantes";

static function getCategory(): array
{
return [
self::CATEGORY_LABEL_REVOLT => self::CATEGORY_REVOLT,
self::CATEGORY_LABEL_DREAM => self::CATEGORY_DREAM,
self::CATEGORY_LABEL_PROJECTBOOST => self::CATEGORY_PROJECTBOOST,
self::CATEGORY_LABEL_PROJECTINSPIRING => self::CATEGORY_PROJECTINSPIRING,
];
}

static function getCategoryByLabel(string $label): string
{
$categoryArray = self::getCategory();

return $categoryArray[$label];
}
}

+ 41
- 0
Model/Dream/Dream.php Datei anzeigen

@@ -0,0 +1,41 @@
<?php

namespace Lc\PietroBundle\Model\Dream;

use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;
use Lc\PietroBundle\Model\IndividualData\IndividualDataInterface;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Dream implements DescriptionProjectInterface, DreamInterface, EntityInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualData\IndividualDataInterface", inversedBy="dream")
*/
protected $individualData;


public function __toString()
{
return "Nos rêves";
}

public function getIndividualData(): ?IndividualDataInterface
{
return $this->individualData;
}

public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;

return $this;
}

}

+ 8
- 0
Model/Dream/DreamInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\Dream;

interface DreamInterface
{

}

+ 302
- 0
Model/IndividualData/IndividualData.php Datei anzeigen

@@ -0,0 +1,302 @@
<?php

namespace Lc\PietroBundle\Model\IndividualData;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Model\AbstractData;
use Lc\PietroBundle\Model\Dream\DreamInterface;
use Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface;
use Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface;
use Lc\PietroBundle\Model\Revolt\RevoltInterface;
use Lc\PietroBundle\Model\Territory\TerritoryInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class IndividualData extends AbstractData implements IndividualDataInterface
{

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $email;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $introQuestion;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $introAnswer;

/**
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Revolt\RevoltInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $revolt;

/**
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Dream\DreamInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $dream;

/**
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $projectBoost;

/**
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface", mappedBy="individualData", cascade={"persist", "remove"})
*/
protected $projectInspiring;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Territory\TerritoryInterface", inversedBy="individualData")
*/
protected $territory;

public function __construct()
{
$this->revolt = new ArrayCollection();
$this->dream = new ArrayCollection();
$this->projectBoost = new ArrayCollection();
$this->projectInspiring = new ArrayCollection();
}

public function getResume()
{
return count($this->getRevolt()) . " révolte(s) - " . count($this->getDream()) . " rêve(s) - " . count(
$this->getProjectBoost()
) . " projet(s) boosté(s) - " . count($this->getProjectInspiring()) . " projets inspirants";
}

public function __toString()
{
return $this->firstname . " " . $this->lastname;
}

public function getNbDream(): string
{
return count($this->getDream());
}

public function getNbRevolt(): string
{
return count($this->getRevolt());
}

public function getNbProjectBoost(): string
{
return count($this->getProjectBoost());
}

public function getNbProjectInspiring(): string
{
return count($this->getProjectInspiring());
}

public function getFirstname(): ?string
{
return $this->firstname;
}

public function setFirstname(string $firstname): self
{
$this->firstname = $firstname;

return $this;
}

public function getLastname(): ?string
{
return $this->lastname;
}

public function setLastname(string $lastname): self
{
$this->lastname = $lastname;

return $this;
}

public function getEmail(): ?string
{
return $this->email;
}

public function setEmail(string $email): self
{
$this->email = $email;

return $this;
}

public function getIntroQuestion(): ?string
{
return $this->introQuestion;
}

public function setIntroQuestion(string $introQuestion): self
{
$this->introQuestion = $introQuestion;

return $this;
}

public function getIntroAnswer(): ?string
{
return $this->introAnswer;
}

public function setIntroAnswer(?string $introAnswer): self
{
$this->introAnswer = $introAnswer;

return $this;
}

/**
* @return Collection|RevoltInterface[]
*/
public function getRevolt(): Collection
{
return $this->revolt;
}

public function addRevolt(RevoltInterface $revolt): self
{
if (!$this->revolt->contains($revolt)) {
$this->revolt[] = $revolt;
$revolt->setIndividualData($this);
}

return $this;
}

public function removeRevolt(RevoltInterface $revolt): self
{
if ($this->revolt->removeElement($revolt)) {
// set the owning side to null (unless already changed)
if ($revolt->getIndividualData() === $this) {
$revolt->setIndividualData(null);
}
}

return $this;
}

/**
* @return Collection|DreamInterface[]
*/
public function getDream(): Collection
{
return $this->dream;
}

public function addDream(DreamInterface $dream): self
{
if (!$this->dream->contains($dream)) {
$this->dream[] = $dream;
$dream->setIndividualData($this);
}

return $this;
}

public function removeDream(DreamInterface $dream): self
{
if ($this->dream->removeElement($dream)) {
// set the owning side to null (unless already changed)
if ($dream->getIndividualData() === $this) {
$dream->setIndividualData(null);
}
}

return $this;
}

/**
* @return Collection|ProjectBoostInterface[]
*/
public function getProjectBoost(): Collection
{
return $this->projectBoost;
}

public function addProjectBoost(ProjectBoostInterface $projectBoost): self
{
if (!$this->projectBoost->contains($projectBoost)) {
$this->projectBoost[] = $projectBoost;
$projectBoost->setIndividualData($this);
}

return $this;
}

public function removeProjectBoost(ProjectBoostInterface $projectBoost): self
{
if ($this->projectBoost->removeElement($projectBoost)) {
// set the owning side to null (unless already changed)
if ($projectBoost->getIndividualData() === $this) {
$projectBoost->setIndividualData(null);
}
}

return $this;
}

/**
* @return Collection|ProjectInspiringInterface[]
*/
public function getProjectInspiring(): Collection
{
return $this->projectInspiring;
}

public function addProjectInspiring(ProjectInspiringInterface $projectInspiring): self
{
if (!$this->projectInspiring->contains($projectInspiring)) {
$this->projectInspiring[] = $projectInspiring;
$projectInspiring->setIndividualData($this);
}

return $this;
}

public function removeProjectInspiring(ProjectInspiringInterface $projectInspiring): self
{
if ($this->projectInspiring->removeElement($projectInspiring)) {
// set the owning side to null (unless already changed)
if ($projectInspiring->getIndividualData() === $this) {
$projectInspiring->setIndividualData(null);
}
}

return $this;
}

public function getTerritory(): ?TerritoryInterface
{
return $this->territory;
}

public function setTerritory(?TerritoryInterface $territory): self
{
$this->territory = $territory;

return $this;
}
}

+ 8
- 0
Model/IndividualData/IndividualDataInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\IndividualData;

interface IndividualDataInterface
{

}

+ 39
- 0
Model/ProjectBoost/ProjectBoost.php Datei anzeigen

@@ -0,0 +1,39 @@
<?php

namespace Lc\PietroBundle\Model\ProjectBoost;

use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;
use Lc\PietroBundle\Model\IndividualData\IndividualData;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class ProjectBoost implements DescriptionProjectInterface, ProjectBoostInterface, EntityInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualData\IndividualDataInterface", inversedBy="projectBoost")
*/
protected $individualData;

public function __toString()
{
return "Les actions à booster";
}

public function getIndividualData(): ?IndividualData
{
return $this->individualData;
}

public function setIndividualData(?IndividualData $individualData): self
{
$this->individualData = $individualData;

return $this;
}
}

+ 8
- 0
Model/ProjectBoost/ProjectBoostInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\ProjectBoost;

interface ProjectBoostInterface
{

}

+ 40
- 0
Model/ProjectInspiring/ProjectInspiring.php Datei anzeigen

@@ -0,0 +1,40 @@
<?php

namespace Lc\PietroBundle\Model\ProjectInspiring;

use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;
use Lc\PietroBundle\Model\IndividualData\IndividualDataInterface;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class ProjectInspiring implements DescriptionProjectInterface, ProjectInspiringInterface, EntityInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualData\IndividualDataInterface", inversedBy="projectInspiring")
*/
protected $individualData;


public function __toString()
{
return "Les actions inspirantes";
}

public function getIndividualData(): ?IndividualDataInterface
{
return $this->individualData;
}

public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;

return $this;
}
}

+ 8
- 0
Model/ProjectInspiring/ProjectInspiringInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\ProjectInspiring;

interface ProjectInspiringInterface
{

}

+ 40
- 0
Model/Revolt/Revolt.php Datei anzeigen

@@ -0,0 +1,40 @@
<?php

namespace Lc\PietroBundle\Model\Revolt;

use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectInterface;
use Lc\PietroBundle\Doctrine\Extension\DescriptionProjectTrait;
use Lc\PietroBundle\Model\IndividualData\IndividualDataInterface;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Revolt implements DescriptionProjectInterface, RevoltInterface, EntityInterface
{
use DescriptionProjectTrait;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\IndividualData\IndividualDataInterface", inversedBy="revolt")
*/
protected $individualData;


public function __toString()
{
return "Nos révoltes";
}

public function getIndividualData(): ?IndividualDataInterface
{
return $this->individualData;
}

public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;

return $this;
}
}

+ 8
- 0
Model/Revolt/RevoltInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\Revolt;

interface RevoltInterface
{

}

+ 52
- 0
Model/Subthematic/Subthematic.php Datei anzeigen

@@ -0,0 +1,52 @@
<?php

namespace Lc\PietroBundle\Model\Subthematic;

use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Model\Thematic\ThematicInterface;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Subthematic implements SubthematicInterface, EntityInterface
{
/**
* @ORM\Column(type="string", length=255)
*/
protected $name;

/**
* @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Thematic\ThematicInterface", inversedBy="subthematic")
*/
protected $thematic;

public function __toString()
{
return $this->name;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

public function getThematic(): ?ThematicInterface
{
return $this->thematic;
}

public function setThematic(?ThematicInterface $thematic): self
{
$this->thematic = $thematic;

return $this;
}
}

+ 8
- 0
Model/Subthematic/SubthematicInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\Subthematic;

interface SubthematicInterface
{

}

+ 94
- 0
Model/Territory/Territory.php Datei anzeigen

@@ -0,0 +1,94 @@
<?php

namespace Lc\PietroBundle\Model\Territory;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Model\IndividualData\IndividualDataInterface;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\DevAliasInterface;
use Lc\SovBundle\Doctrine\Extension\DevAliasTrait;

/**
* @ORM\MappedSuperclass()
*/
abstract class Territory implements TerritoryInterface, DevAliasInterface, EntityInterface
{
use DevAliasTrait;


/**
* @ORM\Column(type="string", length=255)
*/
protected $name;

/**
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\IndividualData\IndividualDataInterface", mappedBy="territory")
*/
protected $individualData;

public function __construct()
{
$this->individualData = new ArrayCollection();
}

public function __toString()
{
return $this->name;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

public function getIndividualData(): ?Collection
{
return $this->individualData;
}

public function setIndividualData(?IndividualDataInterface $individualData): self
{
$this->individualData = $individualData;

return $this;
}

/**
* @return Collection|TerritoryInterface[]
*/
public function getTerritory(): Collection
{
return $this->territory;
}

public function addTerritory(TerritoryInterface $territory): self
{
if (!$this->territory->contains($territory)) {
$this->territory[] = $territory;
$territory->setIndividualData($this);
}

return $this;
}

public function removeTerritory(TerritoryInterface $territory): self
{
if ($this->territory->removeElement($territory)) {
// set the owning side to null (unless already changed)
if ($territory->getIndividualData() === $this) {
$territory->setIndividualData(null);
}
}

return $this;
}
}

+ 8
- 0
Model/Territory/TerritoryInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\Territory;

interface TerritoryInterface
{

}

+ 79
- 0
Model/Thematic/Thematic.php Datei anzeigen

@@ -0,0 +1,79 @@
<?php

namespace Lc\PietroBundle\Model\Thematic;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\PietroBundle\Model\Subthematic\SubthematicInterface;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class Thematic implements ThematicInterface, EntityInterface
{

/**
* @ORM\Column(type="string", length=255)
*/
protected $name;

/**
* @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Subthematic\SubthematicInterface", mappedBy="thematic", cascade={"persist", "remove"})
*/
protected $subthematic;


public function __construct()
{
$this->subthematic = new ArrayCollection();
}

public function __toString()
{
return $this->name;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

/**
* @return Collection|SubthematicInterface[]
*/
public function getSubthematic(): Collection
{
return $this->subthematic;
}

public function addSubthematic(SubthematicInterface $subthematic): self
{
if (!$this->subthematic->contains($subthematic)) {
$this->subthematic[] = $subthematic;
$subthematic->setThematic($this);
}

return $this;
}

public function removeSubthematic(SubthematicInterface $subthematic): self
{
if ($this->subthematic->removeElement($subthematic)) {
// set the owning side to null (unless already changed)
if ($subthematic->getThematic() === $this) {
$subthematic->setThematic(null);
}
}

return $this;
}
}

+ 8
- 0
Model/Thematic/ThematicInterface.php Datei anzeigen

@@ -0,0 +1,8 @@
<?php

namespace Lc\PietroBundle\Model\Thematic;

interface ThematicInterface
{

}

+ 15
- 0
Repository/Dream/DreamRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Dream;

use App\Entity\Dream\Dream;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class DreamRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Dream::class);
}
}

+ 14
- 0
Repository/Dream/DreamRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,14 @@
<?php

namespace Lc\PietroBundle\Repository\Dream;

use Knp\Component\Pager\PaginatorInterface;
use Lc\PietroBundle\Repository\Search\SearchRepositoryQuery;

class DreamRepositoryQuery extends SearchRepositoryQuery
{
public function __construct(DreamRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, $paginator);
}
}

+ 15
- 0
Repository/Dream/DreamStore.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Dream;

use Lc\PietroBundle\Repository\Search\SearchStore;

class DreamStore extends SearchStore
{
protected $query;

public function __construct(DreamRepositoryQuery $query)
{
$this->query = $query;
}
}

+ 15
- 0
Repository/IndividualData/IndividualDataRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\IndividualData;

use App\Entity\IndividualData\IndividualData;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class IndividualDataRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, IndividualData::class);
}
}

+ 20
- 0
Repository/IndividualData/IndividualDataRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,20 @@
<?php

namespace Lc\PietroBundle\Repository\IndividualData;

use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class IndividualDataRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface
{
public function __construct(IndividualDataRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}

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

+ 33
- 0
Repository/IndividualData/IndividualDataStore.php Datei anzeigen

@@ -0,0 +1,33 @@
<?php

namespace Lc\PietroBundle\Repository\IndividualData;

use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\StoreInterface;

class IndividualDataStore extends AbstractStore implements StoreInterface
{

public function __construct(IndividualDataRepositoryQuery $query)
{
$this->query = $query;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
return $query;
}

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

}

+ 15
- 0
Repository/ProjectBoost/ProjectBoostRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\ProjectBoost;

use App\Entity\ProjectBoost\ProjectBoost;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class ProjectBoostRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ProjectBoost::class);
}
}

+ 14
- 0
Repository/ProjectBoost/ProjectBoostRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,14 @@
<?php

namespace Lc\PietroBundle\Repository\ProjectBoost;

use Knp\Component\Pager\PaginatorInterface;
use Lc\PietroBundle\Repository\Search\SearchRepositoryQuery;

class ProjectBoostRepositoryQuery extends SearchRepositoryQuery
{
public function __construct(ProjectBoostRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, $paginator);
}
}

+ 16
- 0
Repository/ProjectBoost/ProjectBoostStore.php Datei anzeigen

@@ -0,0 +1,16 @@
<?php

namespace Lc\PietroBundle\Repository\ProjectBoost;


use Lc\PietroBundle\Repository\Search\SearchStore;

class ProjectBoostStore extends SearchStore
{
protected $query;

public function __construct(ProjectBoostRepositoryQuery $query)
{
$this->query = $query;
}
}

+ 15
- 0
Repository/ProjectInspiring/ProjectInspiringRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\ProjectInspiring;

use App\Entity\ProjectInspiring\ProjectInspiring;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class ProjectInspiringRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ProjectInspiring::class);
}
}

+ 14
- 0
Repository/ProjectInspiring/ProjectInspiringRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,14 @@
<?php

namespace Lc\PietroBundle\Repository\ProjectInspiring;

use Knp\Component\Pager\PaginatorInterface;
use Lc\PietroBundle\Repository\Search\SearchRepositoryQuery;

class ProjectInspiringRepositoryQuery extends SearchRepositoryQuery
{
public function __construct(ProjectInspiringRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, $paginator);
}
}

+ 15
- 0
Repository/ProjectInspiring/ProjectInspiringStore.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\ProjectInspiring;

use Lc\PietroBundle\Repository\Search\SearchStore;

class ProjectInspiringStore extends SearchStore
{
protected $query;

public function __construct(ProjectInspiringRepositoryQuery $query)
{
$this->query = $query;
}
}

+ 15
- 0
Repository/Revolt/RevoltRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Revolt;

use App\Entity\Revolt\Revolt;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class RevoltRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Revolt::class);
}
}

+ 14
- 0
Repository/Revolt/RevoltRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,14 @@
<?php

namespace Lc\PietroBundle\Repository\Revolt;

use Knp\Component\Pager\PaginatorInterface;
use Lc\PietroBundle\Repository\Search\SearchRepositoryQuery;

class RevoltRepositoryQuery extends SearchRepositoryQuery
{
public function __construct(RevoltRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, $paginator);
}
}

+ 15
- 0
Repository/Revolt/RevoltStore.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Revolt;

use Lc\PietroBundle\Repository\Search\SearchStore;

class RevoltStore extends SearchStore
{
protected $query;

public function __construct(RevoltRepositoryQuery $query)
{
$this->query = $query;
}
}

+ 96
- 0
Repository/Search/SearchRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,96 @@
<?php

namespace Lc\PietroBundle\Repository\Search;

use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Tree\RepositoryInterface;
use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class SearchRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface
{
protected $isJoinCollectifData = false;
protected $isJoinIndividualData = false;
protected $isJoinSubthematic = false;

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

public function filterIsValid()
{
$this->joinCollectifData();
$this->joinIndividualData();

return $this
->andWhere('colData.status = 1 OR indivData.status = 1');
}

public function filterByThematic(ArrayCollection $thematicArray): self
{
return $this
->andWhere('.thematic IN (:thematic)')
->setParameter(':thematic', $thematicArray);
}

public function filterBySubthematicName(string $subthematic): self
{
$this->joinSubthematic();

return $this
->andWhere('subT.name LIKE :subthematic')
->setParameter(':subthematic', '%' . $subthematic . '%');
}

public function filterByDescription(string $description): self
{
return $this
->andWhere('.description LIKE :description')
->setParameter(':description', '%' . $description . '%');
}

public function filterByTerritory(ArrayCollection $territoryArray): self
{
$this->joinCollectifData();
$this->joinIndividualData();

return $this
->andWhere('colData.territory IN (:territory) OR indivData.territory IN (:territory)')
->setParameter(':territory', $territoryArray);
}

public function joinSubthematic(): self
{
if (!$this->isJoinSubthematic) {
$this->isJoinSubthematic = true;

return $this
->leftJoin('.subthematic', 'subT');
}
return $this;
}

public function joinCollectifData(): self
{
if (!$this->isJoinCollectifData) {
$this->isJoinCollectifData = true;

return $this
->leftJoin('.collectifData', 'colData');
}
return $this;
}

public function joinIndividualData(): self
{
if (!$this->isJoinIndividualData) {
$this->isJoinIndividualData = true;

return $this
->leftJoin('.individualData', 'indivData');
}
return $this;
}
}

+ 66
- 0
Repository/Search/SearchStore.php Datei anzeigen

@@ -0,0 +1,66 @@
<?php

namespace Lc\PietroBundle\Repository\Search;


use Lc\PietroBundle\Model\Thematic\ThematicInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\StoreInterface;

class SearchStore extends AbstractStore implements StoreInterface
{

public function __construct($query)
{
$this->query = $query;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
return $query;
}

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->filterIsValid();
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function filterSearch(
?string $subthematic,
ArrayCollection $territoryArray,
ArrayCollection $thematicArray,
$query = null
) {
$query = $this->createDefaultQuery($query);

if (!($thematicArray->isEmpty())) {
$query->filterByThematic($thematicArray);
}
if (!($territoryArray->isEmpty())) {
$query->filterByTerritory($territoryArray);
}
if (!empty($subthematic)) {
$query->filterBySubthematicName($subthematic);
}

return $query->find();
}

public function getByThematic(ThematicInterface $thematic, $query = null)
{
$query = $this->createDefaultQuery($query);
$query->filterByThematic(new ArrayCollection([$thematic]));

return $query->find();
}

}

+ 15
- 0
Repository/Subthematic/SubthematicRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Subthematic;

use App\Entity\Thematic\Subthematic;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class SubthematicRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Subthematic::class);
}
}

+ 15
- 0
Repository/Subthematic/SubthematicRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Subthematic;

use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class SubthematicRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface
{
public function __construct(SubthematicRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 34
- 0
Repository/Subthematic/SubthematicStore.php Datei anzeigen

@@ -0,0 +1,34 @@
<?php

namespace Lc\PietroBundle\Repository\Subthematic;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\StoreInterface;

class SubthematicStore extends AbstractStore implements StoreInterface
{

public function __construct(SubthematicRepositoryQuery $query)
{
$this->query = $query;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
return $query;
}

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

}

+ 15
- 0
Repository/Territory/TerritoryRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Territory;

use App\Entity\Territory\Territory;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class TerritoryRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Territory::class);
}
}

+ 15
- 0
Repository/Territory/TerritoryRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Territory;

use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class TerritoryRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface
{
public function __construct(TerritoryRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 34
- 0
Repository/Territory/TerritoryStore.php Datei anzeigen

@@ -0,0 +1,34 @@
<?php

namespace Lc\PietroBundle\Repository\Territory;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\StoreInterface;

class TerritoryStore extends AbstractStore implements StoreInterface
{

public function __construct(TerritoryRepositoryQuery $query)
{
$this->query = $query;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
return $query;
}

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

}

+ 15
- 0
Repository/Thematic/ThematicRepository.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Thematic;

use App\Entity\Thematic\Thematic;
use Lc\SovBundle\Repository\AbstractRepository;
use Doctrine\Persistence\ManagerRegistry;

class ThematicRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Thematic::class);
}
}

+ 15
- 0
Repository/Thematic/ThematicRepositoryQuery.php Datei anzeigen

@@ -0,0 +1,15 @@
<?php

namespace Lc\PietroBundle\Repository\Thematic;

use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class ThematicRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface
{
public function __construct(ThematicRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 33
- 0
Repository/Thematic/ThematicStore.php Datei anzeigen

@@ -0,0 +1,33 @@
<?php

namespace Lc\PietroBundle\Repository\Thematic;

use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\StoreInterface;

class ThematicStore extends AbstractStore implements StoreInterface
{

public function __construct(ThematicRepositoryQuery $query)
{
$this->query = $query;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
return $query;
}

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

}

+ 16
- 0
Resources/config/services.yaml Datei anzeigen

@@ -0,0 +1,16 @@
services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

Lc\PietroBundle\:
resource: '../../'
exclude:
- '../../DependencyInjection/'
- '../../Entity/'
- '../../Kernel.php'
- '../../Tests/'

Lc\PietroBundle\Controller\:
resource: '../../Controller/'
tags: [ 'controller.service_arguments' ]

+ 62
- 0
Resources/translations/admin.fr.yaml Datei anzeigen

@@ -0,0 +1,62 @@
menu:
data_individual: Formulaire individuel
data_individual_new: Créer
data_individual_validate: Données validées
data_individual_waiting: Données en attente
territory: Territoires
thematic: Thématiques
subthematic: Sous-thémes

entity:
IndividualData:
label: Données individuel
label_plurial: Données du formulaire individuel
fields:
firstname: Prénom
lastname: Nom
territory: Territoire
revolt: Les révoltes
dream: Les rêves
projectBoost: Les projets boostés
projectinspiring: Les projets inspirants
resume: Résumé
nbDream: Rêve(s)
nbRevolt: Révolte(s)
nbProjectBoost: Projet(s) boosté(s)
nbProjectInspiring: Projet(s) inspirant(s)
Thematic:
label_plurial: Les thémes
label: Thématique
fields:
name: Nom
Subthematic:
label_plurial: Les sous-thémes
label: Sous-théme
fields:
name: Nom
thematic: Théme
Territory:
label_plurial: Les territoires
label: Territoire
fields:
name: Nom
form:
field:
dream:
description: Description
thematic: Thématique
subthematic: Sous-thème
projectBoost:
description: Description
thematic: Thématique
subthematic: Sous-thème
projectinspiring:
description: Description
thematic: Thématique
subthematic: Sous-thème
revolt:
description: Description
thematic: Thématique
subthematic: Sous-thème
actions:
export: Export CSV

Laden…
Abbrechen
Speichern