Editing the Controller for our blog
Everything about the controller has been explained in the previous chapter, Chapter 8, Creating Custom CMS Pages, and therefore in this chapter, we limit the scope to just see which changes we need to make for the blog to work properly.
What we are interested in doing now is to create actions that correspond to the rules we have just finished configuring in the previous section. In fact, if we look at the configuration, we can see that the Controller
field contains the name of the bundle (BlogBundle
), followed by the Controller
keyword, followed by the name of the controller (BlogController
). The last part is the name of the action (articleAction
) to be called when the browser URL matches the routing rule.
To clarify these ideas, imagine we write this URL in our browser: https://myblog.com/blog/article/my-first-article. We uniquely identify a blog_article_by_slug
rule. This rule, written in the configuration, indicates that the articleAction...