Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added annotations example to Linking to Pages examples #5781

Merged
merged 4 commits into from
Nov 5, 2015
Merged
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,20 @@ configuration:

.. configuration-block::

.. code-block:: php-annotations

// src/AppBundle/Controller/WelcomeController.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will also need the namespace declaration

class WelcomeController extends Controller
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the beginning of the annotations snippets we should put the use imports needed to make the code work:

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

// ...

{
/**
* @Route("/", name="_welcome")
*/
public function indexAction()
{
// ...
}
}

.. code-block:: yaml

# app/config/routing.yml
Expand Down Expand Up @@ -918,6 +932,20 @@ route:

.. configuration-block::

.. code-block:: php-annotations

// src/AppBundle/Controller/ArticleController.php
class ArticleController extends Controller
{
/**
* @Route("/article/{slug}", name="article_show")
*/
public function showAction($slug)
{
// ...
}
}

.. code-block:: yaml

# app/config/routing.yml
Expand Down