Home » PHP » Pimcore » Custom Route in Pimcore 5

Custom Route in Pimcore 5

Pimcore

Custom routes are an alternative to Symfony’s routing functionalities. The following details are below

/var/www/html/my-project/src/AppBundle/Controller/DefaultController.php

namespace AppBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class DefaultController extends FrontendController {
    /**
     * Fetch data from ajax call.
     * @param Request $request    
     * @Route("/xyz/{id}", methods={"GET"})
     */
    public  function proAjaxAction(Request $request){   
      $this->view->id = $request->get('id');
    }
}

/var/www/html/my-project/src/AppBundle/Resources/config/pimcore/routing.yml

xyz:
    resource: "@AppBundle/Controller/"
    type:     annotation
    prefix:   /

Check Also

Pimcore

How can disable the Pimcore Bundle?

To disable the pimcore bundle run the below command on the ubuntu terminal in the …

Leave a Reply

Your email address will not be published. Required fields are marked *