mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
fix deprecations: use fqcn
This commit is contained in:
parent
7ed0e3fddd
commit
762bb777c3
@ -5,6 +5,7 @@ namespace Chill\CustomFieldsBundle\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||
use Chill\CustomFieldsBundle\Form\CustomFieldType;
|
||||
|
||||
/**
|
||||
* CustomField controller.
|
||||
@ -27,14 +28,14 @@ class CustomFieldController extends Controller
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
|
||||
$this->addFlash('success', $this->get('translator')
|
||||
->trans('The custom field has been created'));
|
||||
|
||||
return $this->redirect($this->generateUrl('customfieldsgroup_show',
|
||||
return $this->redirect($this->generateUrl('customfieldsgroup_show',
|
||||
array('id' => $entity->getCustomFieldsGroup()->getId())));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->addFlash('error', $this->get('translator')
|
||||
->trans("The custom field form contains errors"));
|
||||
|
||||
@ -53,14 +54,14 @@ class CustomFieldController extends Controller
|
||||
*/
|
||||
private function createCreateForm(CustomField $entity, $type)
|
||||
{
|
||||
$form = $this->createForm('custom_field_choice', $entity, array(
|
||||
'action' => $this->generateUrl('customfield_create',
|
||||
$form = $this->createForm(CustomFieldType::class, $entity, array(
|
||||
'action' => $this->generateUrl('customfield_create',
|
||||
array('type' => $type)),
|
||||
'method' => 'POST',
|
||||
'type' => $type,
|
||||
'group_widget' => ($entity->getCustomFieldsGroup()) ? 'hidden' :'entity'
|
||||
));
|
||||
|
||||
|
||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
||||
|
||||
return $form;
|
||||
@ -73,10 +74,10 @@ class CustomFieldController extends Controller
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
$entity = new CustomField();
|
||||
|
||||
|
||||
//add the custom field group if defined in URL
|
||||
$cfGroupId = $request->query->get('customFieldsGroup', null);
|
||||
|
||||
|
||||
if ($cfGroupId !== null) {
|
||||
$cfGroup = $this->getDoctrine()->getManager()
|
||||
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
|
||||
@ -87,7 +88,7 @@ class CustomFieldController extends Controller
|
||||
}
|
||||
$entity->setCustomFieldsGroup($cfGroup);
|
||||
}
|
||||
|
||||
|
||||
$form = $this->createCreateForm($entity, $request->query->get('type'));
|
||||
|
||||
return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array(
|
||||
@ -130,7 +131,7 @@ class CustomFieldController extends Controller
|
||||
}
|
||||
|
||||
$editForm = $this->createEditForm($entity, $entity->getType());
|
||||
|
||||
|
||||
return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array(
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
@ -146,11 +147,11 @@ class CustomFieldController extends Controller
|
||||
*/
|
||||
private function createEditForm(CustomField $entity, $type)
|
||||
{
|
||||
$form = $this->createForm('custom_field_choice', $entity, array(
|
||||
$form = $this->createForm(CustomFieldType::class, $entity, array(
|
||||
'action' => $this->generateUrl('customfield_update', array('id' => $entity->getId())),
|
||||
'method' => 'PUT',
|
||||
'type' => $type,
|
||||
'group_widget' => 'hidden'
|
||||
'group_widget' => 'hidden'
|
||||
));
|
||||
|
||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
||||
@ -176,13 +177,13 @@ class CustomFieldController extends Controller
|
||||
|
||||
if ($editForm->isValid()) {
|
||||
$em->flush();
|
||||
|
||||
|
||||
$this->addFlash('success', $this->get('translator')
|
||||
->trans("The custom field has been updated"));
|
||||
|
||||
return $this->redirect($this->generateUrl('customfield_edit', array('id' => $id)));
|
||||
}
|
||||
|
||||
|
||||
$this->addFlash('error', $this->get('translator')
|
||||
->trans("The custom field form contains errors"));
|
||||
|
||||
|
@ -14,6 +14,9 @@ use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
|
||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer;
|
||||
use Chill\CustomFieldsBundle\Entity\CustomFieldsDefaultGroup;
|
||||
use Chill\CustomFieldsBundle\Form\CustomFieldsGroupType;
|
||||
use Chill\CustomFieldsBundle\Form\CustomFieldType;
|
||||
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType as FormTypeCustomField;
|
||||
|
||||
/**
|
||||
* CustomFieldsGroup controller.
|
||||
@ -127,7 +130,7 @@ class CustomFieldsGroupController extends Controller
|
||||
*/
|
||||
private function createCreateForm(CustomFieldsGroup $entity)
|
||||
{
|
||||
$form = $this->createForm('custom_fields_group', $entity, array(
|
||||
$form = $this->createForm(CustomFieldsGroupType::class, $entity, array(
|
||||
'action' => $this->generateUrl('customfieldsgroup_create'),
|
||||
'method' => 'POST',
|
||||
));
|
||||
@ -227,7 +230,7 @@ class CustomFieldsGroupController extends Controller
|
||||
*/
|
||||
private function createEditForm(CustomFieldsGroup $entity)
|
||||
{
|
||||
$form = $this->createForm('custom_fields_group', $entity, array(
|
||||
$form = $this->createForm(CustomFieldsGroupType::class, $entity, array(
|
||||
'action' => $this->generateUrl('customfieldsgroup_update', array('id' => $entity->getId())),
|
||||
'method' => 'PUT',
|
||||
));
|
||||
@ -369,7 +372,7 @@ class CustomFieldsGroupController extends Controller
|
||||
throw $this->createNotFoundException('Unable to find CustomFieldsGroups entity.');
|
||||
}
|
||||
|
||||
$form = $this->createForm('custom_field', null, array('group' => $entity));
|
||||
$form = $this->createForm(FormTypeCustomField::class, null, array('group' => $entity));
|
||||
$form->add('submit_dump', 'submit', array('label' => 'POST AND DUMP'));
|
||||
$form->add('submit_render','submit', array('label' => 'POST AND RENDER'));
|
||||
$form->handleRequest($request);
|
||||
|
Loading…
x
Reference in New Issue
Block a user