diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 765feebb..6ba73855 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,6 +1,4 @@ security: - enable_authenticator_manager: true - providers: pimcore_admin: id: Pimcore\Security\User\UserProvider diff --git a/src/Controller/AccountController.php b/src/Controller/AccountController.php index 53228953..ce52f6fb 100644 --- a/src/Controller/AccountController.php +++ b/src/Controller/AccountController.php @@ -35,7 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Attribute\IsGranted; @@ -50,9 +50,7 @@ class AccountController extends BaseController { use PasswordMaxLengthTrait; - /** - * @Route("/account/login", name="account-login") - */ + #[Route('/account/login', name: 'account-login')] public function loginAction( AuthenticationUtils $authenticationUtils, Request $request, @@ -92,9 +90,8 @@ public function loginAction( /** * This could be further separated into services, but was kept as single method for demonstration purposes as the * registration process is different on every project. - * - * @Route("/account/register", name="account-register") */ + #[Route('/account/register', name: 'account-register')] public function registerAction( Request $request, CustomerProviderInterface $customerProvider, @@ -183,9 +180,8 @@ public function registerAction( /** * Index page for account - it is restricted to ROLE_USER via security annotation - * - * @Route("/account/index", name="account-index") */ + #[Route('/account/index', name: 'account-index')] #[IsGranted('ROLE_USER')] public function indexAction(UserInterface $user = null): Response { @@ -201,10 +197,9 @@ public function indexAction(UserInterface $user = null): Response } /** - * @Route("/account/update-marketing", name="account-update-marketing-permission") - * * @throws \Exception */ + #[Route('/account/update-marketing', name: 'account-update-marketing-permission')] #[IsGranted('ROLE_USER')] public function updateMarketingPermissionAction( Request $request, @@ -238,9 +233,7 @@ public function updateMarketingPermissionAction( return $this->redirectToRoute('account-index'); } - /** - * @Route("/account/confirm-newsletter", name="account-confirm-newsletter") - */ + #[Route('/account/confirm-newsletter', name: 'account-confirm-newsletter')] public function confirmNewsletterAction( Request $request, NewsletterDoubleOptInService $newsletterDoubleOptInService, @@ -258,10 +251,9 @@ public function confirmNewsletterAction( } /** - * @Route("/account/send-password-recovery", name="account-password-send-recovery") - * * @throws \Exception */ + #[Route('/account/send-password-recovery', name: 'account-password-send-recovery')] public function sendPasswordRecoveryMailAction( Request $request, PasswordRecoveryService $service, @@ -288,9 +280,7 @@ public function sendPasswordRecoveryMailAction( ]); } - /** - * @Route("/account/reset-password", name="account-reset-password") - */ + #[Route('/account/reset-password', name: 'account-reset-password')] public function resetPasswordAction( Request $request, PasswordRecoveryService $service, diff --git a/src/Controller/CartController.php b/src/Controller/CartController.php index 0889afd5..01152bed 100644 --- a/src/Controller/CartController.php +++ b/src/Controller/CartController.php @@ -28,7 +28,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class CartController extends FrontendController { @@ -46,10 +46,9 @@ protected function getCart(): CartInterface } /** - * @Route("/cart/add-to-cart", name="shop-add-to-cart", methods={"POST"}) - * * @throws \Exception */ + #[Route('/cart/add-to-cart', name: 'shop-add-to-cart', methods: ['POST'])] public function addToCartAction(Request $request, Factory $ecommerceFactory): RedirectResponse { if (!$this->isCsrfTokenValid('addToCart', $request->request->getString('_csrf_token'))) { @@ -78,9 +77,7 @@ public function addToCartAction(Request $request, Factory $ecommerceFactory): Re return $this->redirectToRoute('shop-cart-detail'); } - /** - * @Route("/cart", name="shop-cart-detail") - */ + #[Route('/cart', name: 'shop-cart-detail')] public function cartListingAction( Request $request, BreadcrumbHelperService $breadcrumbHelperService, @@ -123,9 +120,7 @@ public function cartListingAction( } } - /** - * @Route("/cart/remove-from-cart", name="shop-remove-from-cart", methods={"POST"}) - */ + #[Route('/cart/remove-from-cart', name: 'shop-remove-from-cart', methods: ['POST'])] public function removeFromCartAction(Request $request, Factory $ecommerceFactory): RedirectResponse { if (!$this->isCsrfTokenValid('cartListing', $request->request->getString('_csrf_token'))) { @@ -149,10 +144,9 @@ public function removeFromCartAction(Request $request, Factory $ecommerceFactory } /** - * @Route("/cart/apply-voucher", name="shop-cart-apply-voucher") - * * @throws \Exception */ + #[Route('/cart/apply-voucher', name: 'shop-cart-apply-voucher')] public function applyVoucherAction(Request $request, Translator $translator, Factory $ecommerceFactory): RedirectResponse { if ($token = strip_tags($request->request->getString('voucher-code'))) { @@ -178,9 +172,7 @@ public function applyVoucherAction(Request $request, Translator $translator, Fac return $this->redirectToRoute('shop-cart-detail'); } - /** - * @Route("/cart/remove-voucher", name="shop-cart-remove-voucher") - */ + #[Route('/cart/remove-voucher', name: 'shop-cart-remove-voucher')] public function removeVoucherAction(Request $request, Translator $translator, Factory $ecommerceFactory): RedirectResponse { if ($token = strip_tags($request->query->getString('voucher-code'))) { diff --git a/src/Controller/CheckoutController.php b/src/Controller/CheckoutController.php index 22f746fc..2ffa056a 100644 --- a/src/Controller/CheckoutController.php +++ b/src/Controller/CheckoutController.php @@ -23,13 +23,11 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class CheckoutController extends FrontendController { - /** - * @Route("/checkout-address", name="shop-checkout-address") - */ + #[Route('/checkout-address', name: 'shop-checkout-address')] public function checkoutAddressAction( Factory $factory, Request $request, @@ -107,12 +105,11 @@ protected function fillDeliveryAddressFromCustomer($deliveryAddress) } /** - * @Route("/checkout-completed", name="shop-checkout-completed") - * * @param Factory $ecommerceFactory * * @return Response */ + #[Route('/checkout-completed', name: 'shop-checkout-completed')] public function checkoutCompletedAction(Request $request, Factory $ecommerceFactory) { $orderId = $request->getSession()->get('last_order_id'); diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 4a9d74f6..685df2d0 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -16,18 +16,27 @@ namespace App\Controller; use Pimcore\Model\Asset; +use Pimcore\Model\DataObject\Car\Listing; use Symfony\Bridge\Twig\Attribute\Template; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class DefaultController extends BaseController { - /** - * @Route("/examples", name="examples") - */ + #[Route('/examples', name: 'examples')] public function examplesAction(): Response { + $cars = new Listing(); + $cars->addConditionParam('manufacturer__id =:brandId', [ 'brandId' => 93]); + + + + $muh = $cars->getTotalCount(); + + + + return $this->render('default/examples.html.twig'); } diff --git a/src/Controller/NewsController.php b/src/Controller/NewsController.php index 84fe66c1..8d1865fb 100644 --- a/src/Controller/NewsController.php +++ b/src/Controller/NewsController.php @@ -24,7 +24,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class NewsController extends BaseController { @@ -52,9 +52,7 @@ public function listingAction(Request $request, PaginatorInterface $paginator): ]); } - /** - * @Route("{path}/{newstitle}~n{news}", name="news-detail", defaults={"path"=""}, requirements={"path"=".*?", "newstitle"="[\w-]+", "news"="\d+"}) - */ + #[Route('{path}/{newstitle}~n{news}', name: 'news-detail', requirements: ['path' => '.*?', 'newstitle' => '[\w-]+' ,'news' => '\d+'], defaults: ['path' => ''])] public function detailAction(Request $request, HeadTitle $headTitleHelper, Placeholder $placeholderHelper, NewsLinkGenerator $newsLinkGenerator, BreadcrumbHelperService $breadcrumbHelperService): Response { $news = News::getById($request->attributes->getInt('news')); diff --git a/src/Controller/PaymentController.php b/src/Controller/PaymentController.php index abbfd432..13eb1602 100644 --- a/src/Controller/PaymentController.php +++ b/src/Controller/PaymentController.php @@ -27,13 +27,11 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class PaymentController extends FrontendController { - /** - * @Route("/checkout-payment", name="shop-checkout-payment") - */ + #[Route('/checkout-payment', name: 'shop-checkout-payment')] public function checkoutPaymentAction(Factory $factory, BreadcrumbHelperService $breadcrumbHelperService): Response { $cartManager = $factory->getCartManager(); @@ -62,9 +60,7 @@ public function checkoutPaymentAction(Factory $factory, BreadcrumbHelperService ]); } - /** - * @Route("/checkout-start-payment", name="shop-checkout-start-payment") - */ + #[Route('/checkout-start-payment', name: 'shop-checkout-start-payment')] public function startPaymentAction(Factory $factory): JsonResponse { $cartManager = $factory->getCartManager(); @@ -88,9 +84,7 @@ public function startPaymentAction(Factory $factory): JsonResponse return new JsonResponse($response->getJsonString(), 200, [], true); } - /** - * @Route("/payment-error", name = "shop-checkout-payment-error") - */ + #[Route('/payment-error', name: 'shop-checkout-payment-error')] public function paymentErrorAction(): RedirectResponse { $this->addFlash('danger', 'Payment error'); @@ -98,9 +92,7 @@ public function paymentErrorAction(): RedirectResponse return $this->redirectToRoute('shop-checkout-payment'); } - /** - * @Route("/payment-commit-order", name="shop-commit-order") - */ + #[Route('/payment-commit-order', name: 'shop-commit-order')] public function commitOrderAction(Request $request, Factory $factory): RedirectResponse { $cartManager = $factory->getCartManager(); diff --git a/src/Controller/ProductController.php b/src/Controller/ProductController.php index 9da198ac..769e496c 100644 --- a/src/Controller/ProductController.php +++ b/src/Controller/ProductController.php @@ -40,7 +40,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class ProductController extends BaseController { @@ -50,12 +50,11 @@ public function productDetailSlugAction(AbstractObject $object): Response } /** - * @Route("/shop/{path}{productname}~p{product}", name="shop-detail", defaults={"path"=""}, requirements={"path"=".*?", "productname"="[\w-]+", "product"="\d+"}) - * * @param Concrete $product built-in parameter conversion, please see https://github.com/pimcore/pimcore/pull/5554 * * @throws \Exception */ + #[Route('/shop/{path}{productname}~p{product}', name: 'shop-detail', defaults: ['path' => ''], requirements: ['path' => '.*?', 'productname' => '[\w-]+', 'product' => '\d+'])] public function detailAction( Request $request, HeadTitle $headTitleHelper, @@ -121,9 +120,7 @@ public function detailAction( throw new NotFoundHttpException('Unsupported Product type.'); } - /** - * @Route("/shop/{path}{categoryname}~c{category}", name="shop-category", defaults={"path"=""}, requirements={"path"=".*?", "categoryname"="[\w-]+", "category"="\d+"}) - */ + #[Route('/shop/{path}{categoryname}~c{category}', name: 'shop-category', defaults: ['path' => ''], requirements: ['path' => '.*?', 'categoryname' => '[\w-]+', 'category' => '\d+'])] public function listingAction( Request $request, HeadTitle $headTitleHelper, @@ -221,9 +218,7 @@ public function productTeaserAction(Request $request, Factory $ecommerceFactory) throw new NotFoundHttpException('Product not found.'); } - /** - * @Route("/search", name="search", methods={"GET"}) - */ + #[Route('/search', name: 'search', methods: ['GET'])] public function searchAction( Request $request, ListHelper $listHelper, diff --git a/src/Controller/Web2printController.php b/src/Controller/Web2printController.php index 1aeb0333..4ae96407 100644 --- a/src/Controller/Web2printController.php +++ b/src/Controller/Web2printController.php @@ -22,7 +22,7 @@ use Pimcore\Bundle\WebToPrintBundle\Processor; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; class Web2printController extends BaseController { @@ -92,10 +92,9 @@ public function productCellAction(Request $request): Response } /** - * @Route("/product-print", name="product_print") - * * @throws \Exception */ + #[Route('/product-print', name: 'product_print')] public function productPrintAction(Request $request): Response { $objId = $request->query->getInt('id'); diff --git a/src/Form/DeliveryAddressFormType.php b/src/Form/DeliveryAddressFormType.php index 2634fe2f..466caab6 100644 --- a/src/Form/DeliveryAddressFormType.php +++ b/src/Form/DeliveryAddressFormType.php @@ -15,7 +15,7 @@ namespace App\Form; -use Pimcore\Localization\LocaleService; +use Pimcore\Localization\LocaleServiceInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -27,7 +27,7 @@ class DeliveryAddressFormType extends AbstractType { - public function __construct(protected LocaleService $locale) + public function __construct(protected LocaleServiceInterface $locale) { }