Browse Source

form collectif

master
Charly 3 years ago
parent
commit
80571d243f
13 changed files with 61 additions and 30 deletions
  1. +33
    -22
      src/Controller/Admin/CollectifDataCrudController.php
  2. +1
    -1
      src/Controller/Admin/ConfigurationCrudController.php
  3. +1
    -1
      src/Controller/Admin/DashboardAnimatorController.php
  4. +1
    -1
      src/Controller/Admin/DashboardController.php
  5. +1
    -1
      src/Controller/Admin/PageCrudController.php
  6. +1
    -1
      src/Controller/Admin/TerritoryCrudController.php
  7. +1
    -1
      src/Controller/Admin/ThematicCrudController.php
  8. +1
    -1
      src/Controller/Admin/UserCrudController.php
  9. +1
    -1
      src/Entity/CollectifData.php
  10. +5
    -0
      src/Entity/Dreams.php
  11. +5
    -0
      src/Entity/ProjectsBoost.php
  12. +5
    -0
      src/Entity/ProjectsInspiring.php
  13. +5
    -0
      src/Entity/Revolts.php

+ 33
- 22
src/Controller/Admin/CollectifDataCrudController.php View File

use App\Type\RevoltsType; use App\Type\RevoltsType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;
use Lc\SovBundle\Field\CollectionField; use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\StatusField; use Lc\SovBundle\Field\StatusField;




public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
return [
AssociationField::new('territory'),
IntegerField::new('nbParticipant'),
CollectionField::new('revolts')
->setFormTypeOption('entry_type', RevoltsType::class)
->setFormTypeOption('mapped', true)
->setRequired(false),
CollectionField::new('dreams')
->setFormTypeOption('entry_type', DreamsType::class)
->setRequired(false),
CollectionField::new('projectsboost')
->setFormTypeOption('entry_type', ProjectsBoostType::class)
->setRequired(false),
CollectionField::new('projectsinspiring')
->setFormTypeOption('entry_type', ProjectsInspiringType::class)
->setRequired(false),
StatusField::new('status')->setRequired(false)
];
$fields = array();

$fields[] = AssociationField::new('territory');
$fields[] = IntegerField::new('nbParticipant');
$fields[] = CollectionField::new('revolts')
->setFormTypeOption('entry_type', RevoltsType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$fields[] = CollectionField::new('dreams')
->setFormTypeOption('entry_type', DreamsType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$fields[] = CollectionField::new('projectsboost')
->setFormTypeOption('entry_type', ProjectsBoostType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$fields[] = CollectionField::new('projectsinspiring')
->setFormTypeOption('entry_type', ProjectsInspiringType::class)
->setFormTypeOption('by_reference', false)
->setRequired(false);
$hasAccess = $this->isGranted('ROLE_ADMIN');
if ($hasAccess) {
$fields[] = StatusField::new('status')
->setFormTypeOption('data', 0);
} else {
$fields[] = HiddenField::new('status')
->setFormTypeOption('data', 0);
}


return $fields;
} }


public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void
{ {
$entityInstance->setUser($this->getUser());
dump($entityInstance);
die;
$entityManager->persist($entityInstance); $entityManager->persist($entityInstance);
$entityManager->flush(); $entityManager->flush();



+ 1
- 1
src/Controller/Admin/ConfigurationCrudController.php View File



use App\Entity\Configuration; use App\Entity\Configuration;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;


class ConfigurationCrudController extends AbstractCrudController class ConfigurationCrudController extends AbstractCrudController
{ {

+ 1
- 1
src/Controller/Admin/DashboardAnimatorController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController;
use Lc\SovBundle\Controller\Dashboard\DashboardController as SovDashboardController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;


class DashboardAnimatorController extends SovDashboardController class DashboardAnimatorController extends SovDashboardController

+ 1
- 1
src/Controller/Admin/DashboardController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController;
use Lc\SovBundle\Controller\Dashboard\DashboardController as SovDashboardController;


class DashboardController extends SovDashboardController class DashboardController extends SovDashboardController
{ {

+ 1
- 1
src/Controller/Admin/PageCrudController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;;
use Lc\SovBundle\Field\CKEditorField; use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\FileManagerField; use Lc\SovBundle\Field\FileManagerField;
use Lc\SovBundle\Field\GalleryManagerField; use Lc\SovBundle\Field\GalleryManagerField;

+ 1
- 1
src/Controller/Admin/TerritoryCrudController.php View File



use App\Entity\Territory; use App\Entity\Territory;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;


class TerritoryCrudController extends AbstractCrudController class TerritoryCrudController extends AbstractCrudController
{ {

+ 1
- 1
src/Controller/Admin/ThematicCrudController.php View File

use App\Entity\Thematic; use App\Entity\Thematic;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;


class ThematicCrudController extends AbstractCrudController class ThematicCrudController extends AbstractCrudController
{ {

+ 1
- 1
src/Controller/Admin/UserCrudController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField; use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\UserCrudController as AbstractUserCrudController;
use Lc\SovBundle\Controller\User\UserAdminController as AbstractUserCrudController;
use Lc\SovBundle\Doctrine\EntityManager; use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Translation\TranslatorAdmin; use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\RequestStack;

+ 1
- 1
src/Entity/CollectifData.php View File



public function __toString() public function __toString()
{ {
return $this->user->getFirstname() . " " . $this->user->getLastname() . " - " . $this->territory;
return $this->nbParticipant . " participants";
} }


public function getId(): ?int public function getId(): ?int

+ 5
- 0
src/Entity/Dreams.php View File

*/ */
private $collectifData; private $collectifData;


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

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 5
- 0
src/Entity/ProjectsBoost.php View File

*/ */
private $collectifData; private $collectifData;


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

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 5
- 0
src/Entity/ProjectsInspiring.php View File

*/ */
private $collectifData; private $collectifData;


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

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

+ 5
- 0
src/Entity/Revolts.php View File

*/ */
private $collectifData; private $collectifData;


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

public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

Loading…
Cancel
Save