|
|
@@ -13,6 +13,9 @@ class ProfileManagerController extends AbstractController
|
|
|
public function follow($username): Response
|
|
|
{
|
|
|
$session = $this->get('session');
|
|
|
+ if (null === $session->get('user')) {
|
|
|
+ return $this->redirectToRoute('login');
|
|
|
+ }
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
$repository_profile = $em->getRepository(User::class);
|
|
|
$profile = $repository_profile->findOneBy(array('username' => $session->get('user')));
|
|
|
@@ -29,6 +32,9 @@ class ProfileManagerController extends AbstractController
|
|
|
public function unfollow($username): Response
|
|
|
{
|
|
|
$session = $this->get('session');
|
|
|
+ if (null === $session->get('user')) {
|
|
|
+ return $this->redirectToRoute('login');
|
|
|
+ }
|
|
|
$em = $this->getDoctrine()->getManager();
|
|
|
$repository_profile = $em->getRepository(User::class);
|
|
|
$profile = $repository_profile->findOneBy(array('username' => $session->get('user')));
|