Install Report Builder
Report Metadata

Symfony2/Doctrine Report Builder - Basic Usage

The report builder creates reports by selecting a base object and reading the doctrine metadata for the relationships/fields on that entity. A user is able to select from the pre-configured base entities, the available display fields, and even filter the results.

Report Types

Two different report types are available, aggregate and detailed. An aggregate report counts the number ov base elements that match the supplied filters. A detailed report simply gives all of the records.

Defining Base Elements

Defining base elements is the critical part of creating ad-hoc reports. Which elements you need entirely depends on your schema and business needs. For example, if your application/reporting needs are focused on users, you would want the user entity listed. If you have an e-commerce system, you might want a "products", or an "order" entities listed.

Define your base entities in your config.yml

# config.yml
            - 'Brown298\DtTestBundle\Entity\User'

Create an Aggregate Report (example)

As an example of building an aggregate report, in our demo section, we have a "user" table and a "faq" table. If we wanted to know for how many faq questions each user has created, we would create a report by selecting:

  1. Aggregation Step: select "aggregate" indicating we want to create an aggregate report type
  2. Base Element Step: select "user" indicating we want to count the users
  3. Fields Step: select "first name", "last name" so we will see the user's names
  4. Filter Step: select "Create a filter", expand the "faq" selection and pick "question". the filtering options show up, choose "is not empty". (Hint: click "save and update preview" to preview the results)
  5. Order Step: select "count" and pick ascending to sort the results in ascending order.
  6. Publish Step: give your report a name and publish it.
This creates a select query that is essentially equal to:
select count(, User.firstName, User.lastName from User join Faq on = Faq.created_by where Faq.question != '';