Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
security:
enable_authenticator_manager: true

providers:
pimcore_admin:
id: Pimcore\Security\User\UserProvider
Expand Down
26 changes: 8 additions & 18 deletions src/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
{
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
20 changes: 6 additions & 14 deletions src/Controller/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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'))) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'))) {
Expand All @@ -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'))) {
Expand All @@ -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'))) {
Expand Down
9 changes: 3 additions & 6 deletions src/Controller/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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');
Expand Down
17 changes: 13 additions & 4 deletions src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
6 changes: 2 additions & 4 deletions src/Controller/NewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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'));
Expand Down
18 changes: 5 additions & 13 deletions src/Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -88,19 +84,15 @@ 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');

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();
Expand Down
13 changes: 4 additions & 9 deletions src/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions src/Controller/Web2printController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/Form/DeliveryAddressFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,7 +27,7 @@

class DeliveryAddressFormType extends AbstractType
{
public function __construct(protected LocaleService $locale)
public function __construct(protected LocaleServiceInterface $locale)
{
}

Expand Down
Loading