Warning: You are browsing the documentation from version 4 to 10 of Pimcore. Please visit https://pimcore.com/docs/platform/ for the latest versions of Pimcore.
Version:

MVC in Pimcore

In terms of sending output to the frontend, Pimcore follows the MVC pattern. Therefore it is crucial to know the fundamentals about the pattern in general and the specifics in combination with Pimcore.

MVC is a software design pattern for web applications and separates the code into the following components:

  • Model - defines basic functionality like data access routines, business, etc.
  • View - defines what is presented to the user (the "template")
  • Controller - Controllers brings all the patterns together, they manipulate models, decide which view to display, etc.

If you don't know the MVC pattern please read this article first.

The MVC module of Pimcore is built on top of Symfony. If you are new to Symfony you can read about controllers in the Symfony manual. With this knowledge learning Pimcore will be much easier and faster.

Basic file structure and naming conventions

The most common module for working within the MVC in your Pimcore project is the AppBundle. So the most frequently used folders and files concerning the MVC within the website module are the following:

Path Description Example
/src/AppBundle/Controller The controllers directory eg. ContentController.php
/app/Resources/views/ The view (template) directory, the naming (sub folders and file names) follows also the naming-convention of Symfony (/app/Resources/views/[Controller]/[action].html.php) /app/Resources/views/Content/view-single.html.php (if the controller above contains an action called viewSingleAction)

All Pimcore plugins and other modules follow the same pattern.

The following sub chapters provide insight into details of the Pimcore MVC structure and explain the topics