|
@@ -2,10 +2,10 @@
|
|
|
|
|
|
namespace App\Controller;
|
|
|
|
|
|
-use App\Entity\User;
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
|
use App\Form\UserEditProfilType;
|
|
|
use App\Form\ProfileType;
|
|
|
+use App\Repository\ProfileRepository;
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
@@ -37,9 +37,10 @@ class ProfilController extends AbstractController
|
|
|
/**
|
|
|
* @Route("/preferences/", name="user_preferences")
|
|
|
*/
|
|
|
- public function mesPreferencesAction(Request $request, EntityManagerInterface $em): Response
|
|
|
+ public function mesPreferencesAction(Request $request, EntityManagerInterface $em, ProfileRepository $profileRepo): Response
|
|
|
{
|
|
|
- $profile = $this->getUser()->getProfile();
|
|
|
+ $profile = $profileRepo->findByUser($this->getUser());
|
|
|
+
|
|
|
$form = $this->createForm(ProfileType::class , $profile);
|
|
|
$form->handleRequest($request);
|
|
|
if ($form->isSubmitted() && $form->isValid())
|