1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-27 17:28:39 +00:00

Fix tests & deprecation notice

This commit is contained in:
Jeremy Benoist 2016-12-14 11:54:30 +01:00
parent 202a66ce02
commit 21e7ccef3d
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
11 changed files with 25 additions and 21 deletions

View file

@ -23,17 +23,25 @@ class EntryController extends Controller
* @param Request $request
* @param int $page
*
* @Route("/search/{page}", name="search", defaults={"page" = "1"})
* @Route("/search/{page}", name="search", defaults={"page" = 1})
*
* Default parameter for page is hardcoded (in duplication of the defaults from the Route)
* because this controller is also called inside the layout template without any page as argument
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function searchFormAction(Request $request, $page, $currentRoute)
public function searchFormAction(Request $request, $page = 1, $currentRoute = null)
{
// fallback to retrieve currentRoute from query parameter instead of injected one (when using inside a template)
if (null === $currentRoute && $request->query->has('currentRoute')) {
$currentRoute = $request->query->get('currentRoute');
}
$form = $this->createForm(SearchEntryType::class);
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
return $this->showEntries('search', $request, $page);
}
@ -90,7 +98,7 @@ class EntryController extends Controller
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$existingEntry = $this->checkIfEntryAlreadyExists($entry);
if (false !== $existingEntry) {
@ -173,7 +181,7 @@ class EntryController extends Controller
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entry);
$em->flush();