BlogController
Rendering Templates
If you're serving HTML, you'll want to render a template. The render()
method renders a template and puts that content into a Response
object for you:
Templating and Twig are explained more in the Creating and Using Templates article.
Fetching Services
Symfony comes packed with a lot of useful classes and functionalities, called services. These are used for rendering templates, sending emails, querying the database and any other "work" you can think of.
If you need a service in a controller, type-hint an argument with its class (or interface) name. Symfony will automatically pass you the service you need:
The Wordpress Bundle adds two services : PaginationService and BreadcrumbService
get_page_by_state
is a new function available in the WP Steroids plugin, see docs
Fetching Repository
The Wordpress Bundle adds three repository : PostRepository, TermRepository and UserRepository designed to mimic Doctrine Repository way to fetch object from database.
Internally, it still uses Wordpress native functions WP_Query, WP_Term_Query and WP_User_Query to ensure plugins compatibility
Last updated
Was this helpful?