Skip to content

Commit

Permalink
fixes Bee-Lab#12 templates not found in SF4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dodubassman committed Oct 17, 2018
1 parent 18157bd commit 4492c79
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
12 changes: 4 additions & 8 deletions Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
namespace Beelab\UserBundle\Controller;

use Psr\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -18,8 +17,7 @@ class AuthController extends AbstractController
/**
* Login form.
*
* @Route("/login", name="login")
* @Method("GET")
* @Route("/login", name="login", methods={"GET"})
*
* @param AuthorizationCheckerInterface $checker
* @param LoggerInterface $logger
Expand All @@ -42,8 +40,7 @@ public function loginAction(AuthorizationCheckerInterface $checker, LoggerInterf
/**
* Logout (implemented by Symfony security system).
*
* @Route("/logout", name="logout")
* @Method("GET")
* @Route("/logout", name="logout", methods={"GET"})
*/
public function logoutAction(): void
{
Expand All @@ -53,8 +50,7 @@ public function logoutAction(): void
/**
* Login check (implemented by Symfony security system).
*
* @Route("/login_check", name="login_check")
* @Method("POST")
* @Route("/login_check", name="login_check", methods={"POST"})
*/
public function loginCheckAction(): void
{
Expand Down
31 changes: 12 additions & 19 deletions Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use Beelab\UserBundle\Event\FormEvent;
use Beelab\UserBundle\Event\UserEvent;
use Beelab\UserBundle\Manager\UserManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand All @@ -24,8 +23,7 @@ class UserController extends AbstractController
/**
* Lists all User entities (with possible filter).
*
* @Route("", name="user")
* @Method("GET")
* @Route("", name="user", methods={"GET"})
*/
public function indexAction(EventDispatcherInterface $dispatcher, UserManagerInterface $manager, Request $request): Response
{
Expand All @@ -40,7 +38,7 @@ public function indexAction(EventDispatcherInterface $dispatcher, UserManagerInt
}
$users = $manager->getList($request->query->get('page', 1), 20);

return $this->render('BeelabUserBundle:User:index.html.twig', [
return $this->render('@BeelabUser/User/index.html.twig', [
'users' => $users,
'form' => isset($form) ? $form->createView() : null,
]);
Expand All @@ -49,15 +47,14 @@ public function indexAction(EventDispatcherInterface $dispatcher, UserManagerInt
/**
* Finds and displays a User entity.
*
* @Route("/{id}/show", name="user_show")
* @Method("GET")
* @Route("/{id}/show", name="user_show", methods={"GET"})
*/
public function showAction($id, UserManagerInterface $manager): Response
{
$user = $manager->get($id);
$deleteForm = $this->createDeleteForm($user->getId());

return $this->render('BeelabUserBundle:User:show.html.twig', [
return $this->render('@BeelabUser/User/show.html.twig', [
'user' => $user,
'delete_form' => $deleteForm->createView(),
]);
Expand All @@ -66,8 +63,7 @@ public function showAction($id, UserManagerInterface $manager): Response
/**
* Creates a new User entity.
*
* @Route("/new", name="user_new")
* @Method({"GET", "POST"})
* @Route("/new", name="user_new", methods={"GET", "POST"})
*/
public function newAction(UserManagerInterface $manager, Request $request): Response
{
Expand All @@ -79,7 +75,7 @@ public function newAction(UserManagerInterface $manager, Request $request): Resp
return $this->redirectToRoute('user_show', ['id' => $user->getId()]);
}

return $this->render('BeelabUserBundle:User:new.html.twig',[
return $this->render('@BeelabUser/User/new.html.twig',[
'user' => $user,
'form' => $form->createView(),
]);
Expand All @@ -88,8 +84,7 @@ public function newAction(UserManagerInterface $manager, Request $request): Resp
/**
* Edits an existing User entity.
*
* @Route("/{id}/edit", name="user_edit")
* @Method({"GET", "PUT"})
* @Route("/{id}/edit", name="user_edit", methods={"GET", "PUT"})
*/
public function editAction($id, UserManagerInterface $manager, Request $request): Response
{
Expand All @@ -102,7 +97,7 @@ public function editAction($id, UserManagerInterface $manager, Request $request)
}
$deleteForm = $this->createDeleteForm($user->getId());

return $this->render('BeelabUserBundle:User:edit.html.twig',[
return $this->render('@BeelabUser/User/edit.html.twig',[
'user' => $user,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
Expand All @@ -112,8 +107,7 @@ public function editAction($id, UserManagerInterface $manager, Request $request)
/**
* Deletes a User entity.
*
* @Route("/{id}/delete", name="user_delete")
* @Method("DELETE")
* @Route("/{id}/delete", name="user_delete", methods={"DELETE"})
*/
public function deleteAction($id, UserManagerInterface $manager, Request $request): Response
{
Expand All @@ -129,8 +123,7 @@ public function deleteAction($id, UserManagerInterface $manager, Request $reques
/**
* Change password.
*
* @Route("/password", name="user_password")
* @Method({"GET", "POST"})
* @Route("/password", name="user_password", methods={"GET", "POST"})
*/
public function passwordAction(EventDispatcherInterface $dispatcher, UserManagerInterface $manager, Request $request, ParameterBagInterface $bag): Response
{
Expand All @@ -143,7 +136,7 @@ public function passwordAction(EventDispatcherInterface $dispatcher, UserManager
return $this->redirectToRoute($bag->get('beelab_user.route'));
}

return $this->render('BeelabUserBundle:User:password.html.twig', [
return $this->render('@BeelabUser/User/password.html.twig', [
'form' => $form->createView(),
]);
}
Expand Down
4 changes: 1 addition & 3 deletions User/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace Beelab\UserBundle\User;

use Symfony\Component\Security\Core\User\AdvancedUserInterface;

/**
* Interface used by UserManager and User entity.
*/
interface UserInterface extends AdvancedUserInterface
interface UserInterface extends \Symfony\Component\Security\Core\User\UserInterface
{
/**
* @return string
Expand Down

0 comments on commit 4492c79

Please sign in to comment.