Fix nested forms problems with select2 FormTypes in issue 641 and 649

Select2UserLocationType.php is called in another context:
UserController call UserCurrentLocationType which instanciate new Select2UserLocationType.php FormType
This commit is contained in:
2022-10-16 13:21:03 +02:00
parent 5c6068e8a5
commit a46c85d66c
6 changed files with 75 additions and 86 deletions

View File

@@ -15,7 +15,7 @@ use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Entity\GroupCenter;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Form\Type\ComposedGroupCenterType;
use Chill\MainBundle\Form\Type\Select2UserLocationType;
use Chill\MainBundle\Form\UserCurrentLocationType;
use Chill\MainBundle\Form\UserPasswordType;
use Chill\MainBundle\Form\UserType;
use Chill\MainBundle\Pagination\PaginatorInterface;
@@ -234,7 +234,7 @@ class UserController extends CRUDController
public function editCurrentLocationAction(Request $request)
{
$user = $this->getUser();
$form = $this->createForm(Select2UserLocationType::class, $user)
$form = $this->createForm(UserCurrentLocationType::class, $user)
->add('submit', SubmitType::class, ['label' => 'Save'])
->handleRequest($request);