mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Optimized forms for user source
This commit is contained in:
parent
1d7aaeb1dd
commit
04c0f5e9e7
@ -24,6 +24,8 @@ class UserSource extends AbstractSource implements UserSourceInterface
|
|||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @Assert\Type(type="App\Entity\NameSource")
|
||||||
|
* @Assert\Valid()
|
||||||
* @ORM\OneToOne(targetEntity="NameSource",cascade={"persist", "remove"})
|
* @ORM\OneToOne(targetEntity="NameSource",cascade={"persist", "remove"})
|
||||||
* @ORM\JoinColumn(name="name_id", referencedColumnName="id")
|
* @ORM\JoinColumn(name="name_id", referencedColumnName="id")
|
||||||
*
|
*
|
||||||
|
@ -2,9 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
/**
|
use App\Entity\User;
|
||||||
* @author kevinfrantz
|
use Symfony\Component\Form\AbstractType;
|
||||||
*/
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
class NameSourceType
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
|
||||||
|
class NameSourceType extends AbstractType
|
||||||
{
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder->add('name', TextType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => User::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kevinfrantz
|
|
||||||
*/
|
|
||||||
class UserSourceType extends AbstractType
|
class UserSourceType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder->add('namesource', NameSourceType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => User::class
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user