php - Symfony2: Same route path for 2 actions -
is possible have same route path 2 different actions. want use action when user logged in , when user isn't logged in.
/** * @route("/", name="bundle_index") * @template("namebundle:default:index.html.twig") */ /** * @route("/", name="bundle_index_auth") * @security("has_role('role_user')") * @template("namebundle:default:auth.html.twig") */
use same path different names think not, , can't imagine in cases useful if can (maybe if explain better want achieve), looking example can checks need inside same action... checking if role_user granted user (otherwise redirect user or throw access exception whit same behavior of example) , rendering template consequently (obviously other manipulation needed).
Comments
Post a Comment