dmitry-trish/report-bundle

1.2 2017-06-07 10:22 UTC

This package is not auto-updated.

Last update: 2024-09-17 04:04:07 UTC


README

by Dmitry Trish

Installation

  • Add composer package $ composer require dmitry-trish/report-bundle
  • Add new DmitryTrish\ReportBundle\DmitryTrishReportBundle() in appKernel.php $bundles array
  • Update your DB schema $ ./bin/console doctrine:schema:update --force

Usage

Get report service in your controller or whatever your want.

$service = $this->get('dmitry_trish.report.report_service');

Then create a report form. It's handling request automatically.

$form = $service->createForm();

Register submitted form by call register method.

if ($form->isSubmitted() && $form->isValid()) {
    $service->register($form->getData());
}

Advanced

You can register report without creating and handling form. Just create new Report instance and provide report text. Then register it.

use DmitryTrish\ReportBundle\Entity\Report;
...

$report = new Report();
$report->setText('Some report text');

$service->register($report);