Skip to content

Files

Latest commit

f0ef88c · Oct 1, 2017

History

History
52 lines (36 loc) · 1.95 KB

9_datatable_generation.md

File metadata and controls

52 lines (36 loc) · 1.95 KB

WameGeneratorBundle

1. Introduction | 2. Getting started | 3. Configuration options | 4. Entity Generation | 5. CRUD Generation | 6. Enum Generation | 7. Form Generation | 8. Voter Generation | 9. Datatable Generation | 10. Overriding twig files | 11. Extending this bundle

Datatable generation

command: wame:generate:datatable

For an entity a datatable can be generated either during CRUD generation or if you wish to generate a datatable class only, you can use this form-command.

The generator will add the datatable class, but also add the abstract classes 'AppDatatable' and 'DatatableResultService' if they do not exist already. This AppDatatable will be extended by generated datatables.

The DatatableResultService is a service class that will be used in controllers. It will call for a modifyquery callback which you can set in your datatables to change queries to your specific needs. This way you do not need to mess with code inside your controllers.

Argument

You can directly specify the entity class name in the argument.

php bin/console wame:generate:datatable Product

If you need to generate the datatable for an entity in a different bundle than the default bundle, you can use the shortcut notation:

php bin/console wame:generate:voter AcmeBundle:Product

Options

--overwrite

Add this option if you want to overwrite the file if it already exists.

This overwrite option won't affect changes you've made to the AppDatatable and DatatableResultService.