<div class="field">
<input type="password" name="pass" autocomplete="new-password">
<div class="hidden"></div>
</div>
config/routes/annotations.yaml
в config/routes.yml
и отдельно прописать нужный контроллер в конце списка:config/routes.yml
controllers:
resource: ../src/Controller/
type: annotation
page_controller:
resource: ../src/Controller/TextPageController.php
type: annotation
config/routes/dev/*
- тут все стандартно-------------------------- -------- -------- ------ -----------------------------------
Name Method Scheme Host Path
-------------------------- -------- -------- ------ -----------------------------------
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
// Controllers
index ANY ANY ANY /
// Page Controller
page_show ANY ANY ANY /{pageSlug}
page_item ANY ANY ANY /{pageSlug}/{parameters}
-------------------------- -------- -------- ------ -----------------------------------
/**
* @Route("/{slug}/", requirements={"slug"="[^\s\admin]+"})
*/
routing.yml
app:
resource: "@AppBundle/Controller/DefaultController.php"
type: annotation
demo:
resource: "@AppBundle/Controller/DemoController.php"
prefix: "/demo"
type: annotation
other:
resource: "@AppBundle/Controller/OtherController.php"
prefix: "/other"
type: annotation
AbstractController.php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
abstract class AbstractController extends Controller
{
/**
* @param Request $request
* @return Response
* @Route("/")
*/
public function indexAction(Request $request)
{
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
]);
}
/**
* @param Request $request
* @Route("/demo/")
* @return Response
*/
public function demoAction(Request $request)
{
return new Response(sprintf("I'm %s controller", static::class));
}
}
DefaultController.php
namespace AppBundle\Controller;
class DefaultController extends AbstractController {}
OtherController.php
namespace AppBundle\Controller;
class OtherController extends AbstractController {}
DemoController.php
namespace AppBundle\Controller;
class DemoController extends AbstractController {}