fix deprecations: use fqcn for customfieldtype

This commit is contained in:
nobohan 2018-04-04 18:39:02 +02:00
parent 3778012565
commit 7637954a8d

View File

@ -1,20 +1,20 @@
<?php <?php
/* /*
* Chill is a software for social workers * Chill is a software for social workers
* *
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop> * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -29,37 +29,38 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectManager;
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
class ReportType extends AbstractType class ReportType extends AbstractType
{ {
use AppendScopeChoiceTypeTrait; use AppendScopeChoiceTypeTrait;
/** /**
* *
* @var AuthorizationHelper * @var AuthorizationHelper
*/ */
protected $authorizationHelper; protected $authorizationHelper;
/** /**
* *
* @var TranslatableStringHelper * @var TranslatableStringHelper
*/ */
protected $translatableStringHelper; protected $translatableStringHelper;
/** /**
* *
* @var \Doctrine\Common\Persistence\ObjectManager * @var \Doctrine\Common\Persistence\ObjectManager
*/ */
protected $om; protected $om;
/** /**
* *
* @var \Chill\MainBundle\Entity\User * @var \Chill\MainBundle\Entity\User
*/ */
protected $user; protected $user;
public function __construct(AuthorizationHelper $helper, public function __construct(AuthorizationHelper $helper,
TokenStorageInterface $tokenStorage, TokenStorageInterface $tokenStorage,
TranslatableStringHelper $translatableStringHelper, TranslatableStringHelper $translatableStringHelper,
ObjectManager $om) ObjectManager $om)
{ {
@ -68,7 +69,7 @@ class ReportType extends AbstractType
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;
$this->om = $om; $this->om = $om;
} }
/** /**
* @param FormBuilderInterface $builder * @param FormBuilderInterface $builder
* @param array $options * @param array $options
@ -77,24 +78,24 @@ class ReportType extends AbstractType
{ {
$builder $builder
->add('user') ->add('user')
->add('date', 'date', ->add('date', 'date',
array('required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy')) array('required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
->add('cFData', 'custom_field', ->add('cFData', CustomFieldType::class,
array('attr' => array('class' => 'cf-fields'), array('attr' => array('class' => 'cf-fields'),
'group' => $options['cFGroup'])) 'group' => $options['cFGroup']))
; ;
$this->appendScopeChoices($builder, $options['role'], $options['center'], $this->appendScopeChoices($builder, $options['role'], $options['center'],
$this->user, $this->authorizationHelper, $this->user, $this->authorizationHelper,
$this->translatableStringHelper, $this->translatableStringHelper,
$this->om); $this->om);
} }
/** /**
* @param OptionsResolverInterface $resolver * @param OptionsResolver $resolver
*/ */
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults(array(
'data_class' => 'Chill\ReportBundle\Entity\Report' 'data_class' => 'Chill\ReportBundle\Entity\Report'
)); ));
@ -106,7 +107,7 @@ class ReportType extends AbstractType
$resolver->setAllowedTypes(array( $resolver->setAllowedTypes(array(
'cFGroup' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup', 'cFGroup' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup',
)); ));
$this->appendScopeChoicesOptions($resolver); $this->appendScopeChoicesOptions($resolver);
} }