Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2019-09-16 22:04:59 +02:00
parent f7c2f1032f
commit 21a81486df
24 changed files with 64 additions and 84 deletions

View file

@ -41,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/**
* @Route("/attachment_type")

View file

@ -108,7 +108,9 @@ abstract class BaseAdminController extends AbstractController
$this->addFlash('success', $this->translator->trans('entity.created_flash'));
return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]);
} elseif ($form->isSubmitted() && ! $form->isValid()) {
}
if ($form->isSubmitted() && ! $form->isValid()) {
$this->addFlash('error', $this->translator->trans('entity.created_flash.invalid'));
}

View file

@ -32,7 +32,6 @@
namespace App\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Category;
use App\Form\AdminPages\CategoryAdminForm;
use App\Services\EntityExporter;
@ -42,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/**
* @Route("/category")

View file

@ -32,7 +32,6 @@
namespace App\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\PriceInformations\Currency;
use App\Form\AdminPages\CurrencyAdminForm;
use App\Services\EntityExporter;
@ -42,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/**
* @Route("/currency")

View file

@ -32,8 +32,6 @@
namespace App\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Devices\Device;
use App\Form\AdminPages\BaseEntityAdminForm;
use App\Services\EntityExporter;
@ -43,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/**
* @Route("/device")

View file

@ -30,15 +30,11 @@
namespace App\Controller;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Parts\Category;
use App\Entity\Parts\Part;
use App\Form\AttachmentFormType;
use App\Form\Part\PartBaseType;
use App\Services\AttachmentHelper;
use App\Services\PricedetailHelper;
use App\Services\StructuralElementRecursionHelper;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
@ -177,7 +173,9 @@ class PartController extends AbstractController
$this->addFlash('success', $translator->trans('part.created_flash'));
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
} elseif ($form->isSubmitted() && ! $form->isValid()) {
}
if ($form->isSubmitted() && ! $form->isValid()) {
$this->addFlash('error', $translator->trans('part.created_flash.invalid'));
}

View file

@ -178,7 +178,7 @@ class PartListsController extends AbstractController
/**
* @Route("/parts/search/{keyword}", name="parts_search")
*/
public function showSearch(Request $request, DataTableFactory $dataTable, string $keyword = "")
public function showSearch(Request $request, DataTableFactory $dataTable, string $keyword = '')
{
$search = $keyword;

View file

@ -34,7 +34,6 @@ namespace App\Controller;
use App\Entity\UserSystem\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class RedirectController extends AbstractController
{
@ -52,10 +51,8 @@ class RedirectController extends AbstractController
//Check if a user has set a preferred language setting:
$user = $this->getUser();
if ($user instanceof User) {
if(!empty($user->getLanguage())) {
$locale = $user->getLanguage();
}
if (($user instanceof User) && !empty($user->getLanguage())) {
$locale = $user->getLanguage();
}
//$new_url = str_replace($request->getPathInfo(), '/' . $locale . $request->getPathInfo(), $request->getUri());