namespace App\Controller\Admin; | namespace App\Controller\Admin; | ||||
use App\Entity\CollectifData; | use App\Entity\CollectifData; | ||||
use App\Entity\Configuration; | |||||
use App\Type\DreamsType; | |||||
use App\Type\ProjectsBoostType; | |||||
use App\Type\ProjectsInspiringType; | |||||
use App\Type\RevoltsType; | |||||
use Doctrine\ORM\EntityManagerInterface; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; | |||||
use Lc\SovBundle\Controller\Admin\AbstractCrudController; | use Lc\SovBundle\Controller\Admin\AbstractCrudController; | ||||
use Lc\SovBundle\Field\CollectionField; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
class CollectifDataCrudController extends AbstractCrudController | class CollectifDataCrudController extends AbstractCrudController | ||||
{ | { | ||||
return CollectifData::class; | return CollectifData::class; | ||||
} | } | ||||
/* | |||||
public function configureFields(string $pageName): iterable | public function configureFields(string $pageName): iterable | ||||
{ | { | ||||
return [ | return [ | ||||
IdField::new('id'), | |||||
TextField::new('title'), | |||||
TextEditorField::new('description'), | |||||
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) | |||||
]; | ]; | ||||
} | } | ||||
*/ | |||||
public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void | |||||
{ | |||||
$entityInstance->setUser($this->getUser()); | |||||
dump($entityInstance); | |||||
die; | |||||
$entityManager->persist($entityInstance); | |||||
$entityManager->flush(); | |||||
parent::persistEntity($entityManager, $entityInstance); | |||||
} | |||||
} | } |
->generateUrl(); | ->generateUrl(); | ||||
yield MenuItem::linkToDashboard('dashboard', 'circle'); | yield MenuItem::linkToDashboard('dashboard', 'circle'); | ||||
yield MenuItem::linkToUrl('data_collectif_create', '', $urlCreate); | |||||
yield MenuItem::subMenu('account', 'user') | yield MenuItem::subMenu('account', 'user') | ||||
->setSubItems( | ->setSubItems( | ||||
[ | [ | ||||
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'), | MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'), | ||||
] | ] | ||||
); | ); | ||||
yield MenuItem::linkToUrl('data_collectif_create', '', $urlCreate); | |||||
} | } | ||||
} | } |
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; | use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; | ||||
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\Field\BooleanField; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
class IndividualDataCrudController extends AbstractCrudController | class IndividualDataCrudController extends AbstractCrudController | ||||
{ | { | ||||
TextField::new('lastname'), | TextField::new('lastname'), | ||||
EmailField::new('email'), | EmailField::new('email'), | ||||
TextField::new('introAnswer'), | TextField::new('introAnswer'), | ||||
BooleanField::new('status')->setRequired(false) | |||||
StatusField::new('status')->setRequired(false) | |||||
]; | ]; | ||||
} | } | ||||
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\Field\BooleanField; | |||||
use Lc\SovBundle\Controller\Admin\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; |
private $user; | private $user; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="collectifData") | |||||
* @ORM\OneToMany(targetEntity=Revolts::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $revolts; | private $revolts; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="collectifData") | |||||
* @ORM\OneToMany(targetEntity=Dreams::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $dreams; | private $dreams; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="collectifData") | |||||
* @ORM\OneToMany(targetEntity=ProjectsBoost::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $projectsBoost; | private $projectsBoost; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="collectifData") | |||||
* @ORM\OneToMany(targetEntity=ProjectsInspiring::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | */ | ||||
private $projectsInspiring; | private $projectsInspiring; | ||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->nbParticipant; | |||||
return $this->user->getFirstname() . " " . $this->user->getLastname() . " - " . $this->territory; | |||||
} | } | ||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; |
<?php | |||||
namespace App\Type; | |||||
use App\Entity\Dreams; | |||||
use App\Entity\Thematic; | |||||
use Lc\SovBundle\Doctrine\EntityManager; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||||
use Symfony\Component\Validator\Constraints\NotBlank; | |||||
class DreamsType 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.dreams.description', | |||||
'constraints' => [ | |||||
new NotBlank(), | |||||
], | |||||
] | |||||
) | |||||
->add( | |||||
'thematic', | |||||
EntityType::class, | |||||
[ | |||||
'label' => 'form.field.dreams.thematic', | |||||
'class' => Thematic::class, | |||||
'required' => false, | |||||
] | |||||
); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function configureOptions(OptionsResolver $resolver) | |||||
{ | |||||
$resolver->setDefaults( | |||||
[ | |||||
'data_class' => $this->em->getEntityName(Dreams::class), | |||||
] | |||||
); | |||||
} | |||||
} | |||||
<?php | |||||
namespace App\Type; | |||||
use App\Entity\ProjectsBoost; | |||||
use App\Entity\Thematic; | |||||
use Lc\SovBundle\Doctrine\EntityManager; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||||
use Symfony\Component\Validator\Constraints\NotBlank; | |||||
class ProjectsBoostType 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.projectsboost.description', | |||||
'constraints' => [ | |||||
new NotBlank(), | |||||
], | |||||
] | |||||
) | |||||
->add( | |||||
'thematic', | |||||
EntityType::class, | |||||
[ | |||||
'label' => 'form.field.projectsboost.thematic', | |||||
'class' => Thematic::class, | |||||
'required' => false, | |||||
] | |||||
); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function configureOptions(OptionsResolver $resolver) | |||||
{ | |||||
$resolver->setDefaults( | |||||
[ | |||||
'data_class' => $this->em->getEntityName(ProjectsBoost::class), | |||||
] | |||||
); | |||||
} | |||||
} | |||||
<?php | |||||
namespace App\Type; | |||||
use App\Entity\ProjectsInspiring; | |||||
use App\Entity\Thematic; | |||||
use Lc\SovBundle\Doctrine\EntityManager; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||||
use Symfony\Component\Validator\Constraints\NotBlank; | |||||
class ProjectsInspiringType 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.projectsinspiring.description', | |||||
'constraints' => [ | |||||
new NotBlank(), | |||||
], | |||||
] | |||||
) | |||||
->add( | |||||
'thematic', | |||||
EntityType::class, | |||||
[ | |||||
'label' => 'form.field.projectsinspiring.thematic', | |||||
'class' => Thematic::class, | |||||
'required' => false, | |||||
] | |||||
); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function configureOptions(OptionsResolver $resolver) | |||||
{ | |||||
$resolver->setDefaults( | |||||
[ | |||||
'data_class' => $this->em->getEntityName(ProjectsInspiring::class), | |||||
] | |||||
); | |||||
} | |||||
} | |||||
<?php | |||||
namespace App\Type; | |||||
use App\Entity\Revolts; | |||||
use App\Entity\Thematic; | |||||
use Lc\SovBundle\Doctrine\EntityManager; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | |||||
use Symfony\Component\Validator\Constraints\NotBlank; | |||||
class RevoltsType 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.revolts.description', | |||||
'constraints' => [ | |||||
new NotBlank(), | |||||
], | |||||
] | |||||
) | |||||
->add( | |||||
'thematic', | |||||
EntityType::class, | |||||
[ | |||||
'label' => 'form.field.revolts.thematic', | |||||
'class' => Thematic::class, | |||||
'required' => false, | |||||
] | |||||
); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function configureOptions(OptionsResolver $resolver) | |||||
{ | |||||
$resolver->setDefaults( | |||||
[ | |||||
'data_class' => $this->em->getEntityName(Revolts::class), | |||||
] | |||||
); | |||||
} | |||||
} | |||||
territory: Territoires | territory: Territoires | ||||
thematic: Thématiques | thematic: Thématiques | ||||
configuration: Configuration question Intro | configuration: Configuration question Intro | ||||
entity: | |||||
CollectifData: | |||||
fields: | |||||
territory: Territoire | |||||
nbParticipant: Nombre de participant | |||||
revolts: Les révoltes | |||||
dreams: Les rêves | |||||
projectsboost: Les projets boostés | |||||
projectsinspiring: Les projets inspirants | |||||
form: | |||||
field: | |||||
dreams: | |||||
description: Description | |||||
thematic: Thématique | |||||
projectsboost: | |||||
description: Description | |||||
thematic: Thématique | |||||
projectsinspiring: | |||||
description: Description | |||||
thematic: Thématique | |||||
revolts: | |||||
description: Description | |||||
thematic: Thématique |