Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 1.13 KB

File metadata and controls

26 lines (18 loc) · 1.13 KB

Controllers - Tips and Tricks


go back to Table of contents

1. Adding parameters in view from controllers

Sometimes, you may need to transmit some parameters from your generated controller to your generated view. You can simply do it by overriding the protected getAdditionalRenderParameters function into your bundle. Depending on controller type, prototype is different:

In list controllers (ListController and NestedListController) prototype is:

protected function getAdditionalRenderParameters(); // No parameters

In edit, show and new controllers (EditController, ShowController and NewController) prototype is:

protected function getAdditionalRenderParameters(\Full\Path\To\Your\Object $Object);

This function must return an array. By default, it returns an empty array.

Note: this function is not available in DeleteController because it always returns a RedirectResponse.