ソースを参照

form collectif

master
Charly 3年前
コミット
80571d243f
13個のファイルの変更61行の追加30行の削除
  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 ファイルの表示

@@ -10,8 +10,9 @@ use App\Type\ProjectsInspiringType;
use App\Type\RevoltsType;
use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField;
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\StatusField;

@@ -24,31 +25,41 @@ class CollectifDataCrudController extends AbstractCrudController

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
{
$entityInstance->setUser($this->getUser());
dump($entityInstance);
die;
$entityManager->persist($entityInstance);
$entityManager->flush();


+ 1
- 1
src/Controller/Admin/ConfigurationCrudController.php ファイルの表示

@@ -4,7 +4,7 @@ namespace App\Controller\Admin;

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

class ConfigurationCrudController extends AbstractCrudController
{

+ 1
- 1
src/Controller/Admin/DashboardAnimatorController.php ファイルの表示

@@ -16,7 +16,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
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;

class DashboardAnimatorController extends SovDashboardController

+ 1
- 1
src/Controller/Admin/DashboardController.php ファイルの表示

@@ -16,7 +16,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
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
{

+ 1
- 1
src/Controller/Admin/PageCrudController.php ファイルの表示

@@ -6,7 +6,7 @@ use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
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\FileManagerField;
use Lc\SovBundle\Field\GalleryManagerField;

+ 1
- 1
src/Controller/Admin/TerritoryCrudController.php ファイルの表示

@@ -4,7 +4,7 @@ namespace App\Controller\Admin;

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

class TerritoryCrudController extends AbstractCrudController
{

+ 1
- 1
src/Controller/Admin/ThematicCrudController.php ファイルの表示

@@ -5,7 +5,7 @@ namespace App\Controller\Admin;
use App\Entity\Thematic;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;

class ThematicCrudController extends AbstractCrudController
{

+ 1
- 1
src/Controller/Admin/UserCrudController.php ファイルの表示

@@ -8,7 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
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\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\RequestStack;

+ 1
- 1
src/Entity/CollectifData.php ファイルの表示

@@ -70,7 +70,7 @@ class CollectifData implements StatusInterface, EntityInterface

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

public function getId(): ?int

+ 5
- 0
src/Entity/Dreams.php ファイルの表示

@@ -32,6 +32,11 @@ class Dreams implements DescriptionProjectInterface, EntityInterface
*/
private $collectifData;

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

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

+ 5
- 0
src/Entity/ProjectsBoost.php ファイルの表示

@@ -32,6 +32,11 @@ class ProjectsBoost implements DescriptionProjectInterface, EntityInterface
*/
private $collectifData;

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

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

+ 5
- 0
src/Entity/ProjectsInspiring.php ファイルの表示

@@ -32,6 +32,11 @@ class ProjectsInspiring implements DescriptionProjectInterface, EntityInterface
*/
private $collectifData;

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

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

+ 5
- 0
src/Entity/Revolts.php ファイルの表示

@@ -32,6 +32,11 @@ class Revolts implements DescriptionProjectInterface, EntityInterface
*/
private $collectifData;

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

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

読み込み中…
キャンセル
保存