mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Merge remote-tracking branch 'origin/upgrade-sf3' into upgrade-sf3
This commit is contained in:
commit
bc9fdd7670
@ -23,6 +23,7 @@
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\MainBundle\Form\Type\AddressType;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
@ -239,7 +240,7 @@ class PersonAddressController extends Controller
|
||||
))
|
||||
));
|
||||
|
||||
$form->add('submit', 'submit', array(
|
||||
$form->add('submit', SubmitType::class, array(
|
||||
'label' => 'Submit'
|
||||
));
|
||||
|
||||
@ -261,7 +262,7 @@ class PersonAddressController extends Controller
|
||||
))
|
||||
));
|
||||
|
||||
$form->add('submit', 'submit', array(
|
||||
$form->add('submit', SubmitType::class, array(
|
||||
'label' => 'Submit'
|
||||
));
|
||||
|
||||
|
@ -30,6 +30,7 @@ use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
|
||||
/**
|
||||
@ -75,7 +76,7 @@ class CountryOfBirthAggregator implements AggregatorInterface,
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('group_by_level', 'choice', array(
|
||||
$builder->add('group_by_level', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
'Group by continents' => 'continent',
|
||||
'Group by country' => 'country'
|
||||
|
@ -30,6 +30,7 @@ use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -74,7 +75,7 @@ class NationalityAggregator implements AggregatorInterface,
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('group_by_level', 'choice', array(
|
||||
$builder->add('group_by_level', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
'Group by continents' => 'continent',
|
||||
'Group by country' => 'country'
|
||||
|
@ -27,6 +27,7 @@ use Doctrine\ORM\Query\Expr;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -47,7 +48,7 @@ class GenderFilter implements FilterInterface,
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_genders', 'choice', array(
|
||||
$builder->add('accepted_genders', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
Person::FEMALE_GENDER => 'Woman',
|
||||
Person::MALE_GENDER => 'Man'
|
||||
|
@ -4,11 +4,13 @@ namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
|
||||
class AccompanyingPeriodType extends AbstractType
|
||||
{
|
||||
@ -21,7 +23,7 @@ class AccompanyingPeriodType extends AbstractType
|
||||
//if the period_action is close, date opening should not be seen
|
||||
if ($options['period_action'] !== 'close') {
|
||||
$builder
|
||||
->add('openingDate', 'date', array(
|
||||
->add('openingDate', DateType::class, array(
|
||||
"required" => true,
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd-MM-yyyy'
|
||||
@ -44,22 +46,22 @@ class AccompanyingPeriodType extends AbstractType
|
||||
OR
|
||||
($options['period_action'] === 'update' AND !$accompanyingPeriod->isOpen())
|
||||
) {
|
||||
$form->add('closingDate', 'date', array('required' => true,
|
||||
$form->add('closingDate', DateType::class, array('required' => true,
|
||||
'widget' => 'single_text', 'format' => 'dd-MM-yyyy'));
|
||||
$form->add('closingMotive', 'closing_motive');
|
||||
}
|
||||
});
|
||||
|
||||
$builder->add('remark', 'textarea', array(
|
||||
$builder->add('remark', TextareaType::class, array(
|
||||
'required' => false
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
* @param OptionsResolver $resolver
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\PersonBundle\Entity\AccompanyingPeriod'
|
||||
|
@ -24,8 +24,11 @@ namespace Chill\PersonBundle\Form;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
|
||||
use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer;
|
||||
|
||||
class CreationPersonType extends AbstractType
|
||||
@ -58,20 +61,20 @@ class CreationPersonType extends AbstractType
|
||||
$dateToStringTransformer = new DateTimeToStringTransformer(
|
||||
null, null, 'd-m-Y', false);
|
||||
|
||||
$builder->add('firstName', 'hidden')
|
||||
->add('lastName', 'hidden')
|
||||
->add('birthdate', 'hidden', array(
|
||||
$builder->add('firstName', HiddenType::class)
|
||||
->add('lastName', HiddenType::class)
|
||||
->add('birthdate', HiddenType::class, array(
|
||||
'property_path' => 'birthdate'
|
||||
))
|
||||
->add('gender', 'hidden')
|
||||
->add('creation_date', 'hidden', array(
|
||||
->add('gender', HiddenType::class)
|
||||
->add('creation_date', HiddenType::class, array(
|
||||
'mapped' => false
|
||||
))
|
||||
->add('form_status', 'hidden', array(
|
||||
->add('form_status', HiddenType::class, array(
|
||||
'mapped' => false,
|
||||
'data' => $options['form_status']
|
||||
))
|
||||
->add('center', 'hidden')
|
||||
->add('center', HiddenType::class)
|
||||
;
|
||||
$builder->get('birthdate')
|
||||
->addModelTransformer($dateToStringTransformer);
|
||||
@ -83,18 +86,18 @@ class CreationPersonType extends AbstractType
|
||||
$builder
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('birthdate', 'date', array('required' => false,
|
||||
->add('birthdate', DateType::class, array('required' => false,
|
||||
'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
->add('gender', new GenderType(), array(
|
||||
->add('gender', GenderType::class, array(
|
||||
'required' => true, 'empty_value' => null
|
||||
))
|
||||
->add('creation_date', 'date', array(
|
||||
->add('creation_date', DateType::class, array(
|
||||
'required' => true,
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd-MM-yyyy',
|
||||
'mapped' => false,
|
||||
'data' => new \DateTime()))
|
||||
->add('form_status', 'hidden', array(
|
||||
->add('form_status', HiddenType::class, array(
|
||||
'data' => $options['form_status'],
|
||||
'mapped' => false
|
||||
))
|
||||
|
@ -23,11 +23,15 @@ namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
|
||||
use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\MainBundle\Form\Type\Select2CountryType;
|
||||
use Chill\MainBundle\Form\Type\Select2LanguageType;
|
||||
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
|
||||
|
||||
class PersonType extends AbstractType
|
||||
{
|
||||
@ -59,23 +63,23 @@ class PersonType extends AbstractType
|
||||
$builder
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('birthdate', 'date', array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
->add('gender', new GenderType(), array(
|
||||
->add('birthdate', DateType::class, array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
->add('gender', GenderType::class, array(
|
||||
'required' => true
|
||||
))
|
||||
->add('memo', 'textarea', array('required' => false))
|
||||
->add('memo', TextareaType::class, array('required' => false))
|
||||
;
|
||||
|
||||
if ($this->config['place_of_birth'] === 'visible') {
|
||||
$builder->add('placeOfBirth', 'text', array('required' => false));
|
||||
$builder->add('placeOfBirth', TextType::class, array('required' => false));
|
||||
}
|
||||
|
||||
if ($this->config['phonenumber'] === 'visible') {
|
||||
$builder->add('phonenumber', 'textarea', array('required' => false));
|
||||
$builder->add('phonenumber', TextareaType::class, array('required' => false));
|
||||
}
|
||||
|
||||
if ($this->config['email'] === 'visible') {
|
||||
$builder->add('email', 'textarea', array('required' => false));
|
||||
$builder->add('email', TextareaType::class, array('required' => false));
|
||||
}
|
||||
|
||||
if ($this->config['country_of_birth'] === 'visible') {
|
||||
@ -105,7 +109,7 @@ class PersonType extends AbstractType
|
||||
|
||||
if($options['cFGroup']) {
|
||||
$builder
|
||||
->add('cFData', 'custom_field',
|
||||
->add('cFData', CustomFieldType::class,
|
||||
array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup']))
|
||||
;
|
||||
}
|
||||
@ -114,7 +118,7 @@ class PersonType extends AbstractType
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\PersonBundle\Entity\Person',
|
||||
@ -125,15 +129,15 @@ class PersonType extends AbstractType
|
||||
'cFGroup'
|
||||
));
|
||||
|
||||
$resolver->setAllowedTypes(array(
|
||||
'cFGroup' => array('null', 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup')
|
||||
));
|
||||
$resolver->setAllowedTypes(
|
||||
'cFGroup', array('null', 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'chill_personbundle_person';
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace Chill\PersonBundle\Form\Type;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* A type to add a closing motive
|
||||
@ -33,7 +34,7 @@ class ClosingMotiveType extends AbstractType
|
||||
return 'entity';
|
||||
}
|
||||
|
||||
public function setDefaultOptions(\Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
if ($this->locale === NULL) {
|
||||
throw new \LogicException('the locale should be defined and is extracted '
|
||||
|
@ -3,7 +3,9 @@
|
||||
namespace Chill\PersonBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
/**
|
||||
@ -13,16 +15,11 @@ use Chill\PersonBundle\Entity\Person;
|
||||
*/
|
||||
class GenderType extends AbstractType {
|
||||
|
||||
|
||||
public function getName() {
|
||||
return 'gender';
|
||||
}
|
||||
|
||||
public function getParent() {
|
||||
return 'choice';
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) {
|
||||
public function configureOptions(OptionsResolver $resolver) {
|
||||
|
||||
$a = array(
|
||||
Person::MALE_GENDER => Person::MALE_GENDER,
|
||||
|
@ -21,7 +21,7 @@
|
||||
namespace Chill\PersonBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Chill\MainBundle\Form\Type\DataTransformer\ObjectToIdTransformer;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
@ -61,7 +61,7 @@ class Select2MaritalStatusType extends AbstractType
|
||||
$builder->addModelTransformer($transformer);
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$locale = $this->requestStack->getCurrentRequest()->getLocale();
|
||||
$maritalStatuses = $this->em->getRepository('Chill\PersonBundle\Entity\MaritalStatus')->findAll();
|
||||
|
@ -32,10 +32,10 @@ Chill\PersonBundle\Entity\Person:
|
||||
traverse: true
|
||||
constraints:
|
||||
- Callback:
|
||||
methods: [isAccompanyingPeriodValid]
|
||||
callback: isAccompanyingPeriodValid
|
||||
groups: [accompanying_period_consistent]
|
||||
- Callback:
|
||||
methods: [isAddressesValid]
|
||||
callback: isAddressesValid
|
||||
groups: [addresses_consistent]
|
||||
|
||||
Chill\PersonBundle\Entity\AccompanyingPeriod:
|
||||
|
Loading…
x
Reference in New Issue
Block a user