|
- <?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),
- ]
- );
- }
- }
|