<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
whitedigital-eu / document-generator-bundle example snippets
use Doctrine\ORM\EntityManagerInterface;
use WhiteDigital\DocumentGeneratorBundle\Generator\TwigToPdfGenerator;
use WhiteDigital\DocumentGeneratorBundle\Task\AbstractDocumentTask;
class TestDocumentTask extends AbstractDocumentTask
{
}
public function __construct(
EntityManagerInterface $em,
TwigToPdfGenerator $twigToPdfGenerator,
ReceiptTransformer $receiptTransformer,
) {
parent::__construct($em, $twigToPdfGenerator, $receiptTransformer);
}
public function getTransformerFields(): array
{
return [
'field1' => 'string',
'array1' => [
'array2' => [
'field2' => 'bool',
],
],
]; // array of fields that Transformer can contain
}
public function getTemplatePath(): string
{
return '/path/to/defined/template.html.twig'; // must be in directory visible by twig, usually /templates
}
public function getType(): string
{
return 'TEST'; // simple identifier to separate different documents
}
public function getInputType(): string
{
return 'array'; // what type of data does Transformer
public function __construct(private TestDocumentTask $task)
{
}
public function abc()
{
return $this->task->generate([1, 2, 3]);
}
use WhiteDigital\DocumentGeneratorBundle\Entity\Document;use WhiteDigital\DocumentGeneratorBundle\Task\DocumentTask;
use Doctrine\ORM\EntityManagerInterface;
public function __construct(private DocumentTask $task, private EntityManagerInterface $em)
{
}
public function abc()
{
return $this->task->generate($this->em->getRepository(Document::class)->find(123));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.