I have an error: "Cannot use object of type AppBundle\Entity as array", and it makes no sense for me, imo it's okay.
if ($form->isSubmitted() && $form->isValid()) {
$user = $form->getData();
$repository = $this->getDoctrine()->getRepository(User::class);
$findUser = $repository->findOneBy(['username' => $form->getData()['username']]);
if ($findUser) {
return $this->redirectToRoute('login');
}
Error Cannot use object of type AppBundle\Entity\User as array is at line with "$findUser ="
Can someone explain my why isn't it working?
Symfony 3.3, PHP 7