This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Learn » eZ Publish » Create a feedback form in eZ Publish...

Create a feedback form in eZ Publish 5 using ezforms-bundle

Monday 12 May 2014 3:33:49 pm

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Create a custom bundle to hold your code

When working with a Symfony application like eZ Publish 5, you should always put your code inside a bundle. Bundles are the Symfony way of defining packages and a convenient way to organize your code. They allow you to create reusable services and are easy to reuse in other projects. We'll create an empty bundle so that we'll later be able to store our feedback form definition, twig templates and content mapping rules.

Bundles are traditionally put in the src/ folder or imported by composer inside your vendors/ folder. Conventions are to use your organization's name and your bundle's name as a namespace. Here's some bundle boilerplate code for a FormsTutorial bundle released by the Acme company:



Those 3 files are enough to create an empty bundle:

  • Acme\FormsTutorialBundle\AcmeFormsTutorialBundle class defines a new bundle according to Symfony defaults.
  • Acme\FormsTutorialBundle\DependencyInjection\AcmeFormsTutorialExtension::load() is automatically called when the bundle is initialized. We load the contents of src/Acme/FormsTutorialBundle/Resources/config/services.yml inside the dependency injection container (DIC). DIC is at the heart of the Symfony framework. In a nutshell, it lets you define which services your application will be able to consume and how they are dependent to each other.
  • Finally, we created an empty services definition file only defining the two main keys of the service definition array, parameters and services

Now that the bundle is ready, we can activate it in our kernel class like we did with eZFormsBundle:




Printer Friendly version of the full article on one page with plain styles


Proudly Developed with from