DX: fix cs

This commit is contained in:
2023-02-28 22:39:33 +01:00
parent b1d4334c0f
commit c35ca3dbeb
16 changed files with 134 additions and 20 deletions

View File

@@ -1,5 +1,14 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\DocGeneratorBundle\Service\Generator;
use Chill\DocGeneratorBundle\Context\ContextManagerInterface;
@@ -72,7 +81,7 @@ class Generator implements GeneratorInterface
$entity = $this
->entityManager
->find($context->getEntityClass(), $entityId)
;
;
if (null === $entity) {
throw new RelatedEntityNotFoundException($template->getEntity(), $entityId);
@@ -80,9 +89,9 @@ class Generator implements GeneratorInterface
$contextGenerationDataNormalized = array_merge(
$contextGenerationDataNormalized,
$context instanceof DocGeneratorContextWithPublicFormInterface ?
$context->contextGenerationDataDenormalize($template, $entity, $contextGenerationDataNormalized)
: []
$context instanceof DocGeneratorContextWithPublicFormInterface ?
$context->contextGenerationDataDenormalize($template, $entity, $contextGenerationDataNormalized)
: []
);
$data = $context->getData($template, $entity, $contextGenerationDataNormalized);
@@ -127,7 +136,7 @@ class Generator implements GeneratorInterface
->setType($template->getFile()->getType())
->setFilename(sprintf('%s_odt', uniqid('doc_', true)))
->setStatus(StoredObject::STATUS_READY)
;
;
$this->storedObjectManager->write($destinationStoredObject, $generatedResource);

View File

@@ -1,5 +1,14 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\DocGeneratorBundle\Service\Generator;
class GeneratorException extends \RuntimeException
@@ -12,8 +21,11 @@ class GeneratorException extends \RuntimeException
public function __construct(array $errors = [], \Throwable $previous = null)
{
$this->errors = $errors;
parent::__construct("Could not generate the document", 15252,
$previous);
parent::__construct(
"Could not generate the document",
15252,
$previous
);
}
/**

View File

@@ -1,5 +1,14 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\DocGeneratorBundle\Service\Generator;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;

View File

@@ -1,5 +1,14 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\DocGeneratorBundle\Service\Generator;
class ObjectReadyException extends \RuntimeException

View File

@@ -1,5 +1,14 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\DocGeneratorBundle\Service\Generator;
class RelatedEntityNotFoundException extends \RuntimeException
@@ -9,6 +18,7 @@ class RelatedEntityNotFoundException extends \RuntimeException
parent::__construct(
sprintf("Related entity not found: %s, %s", $relatedEntityClass, $relatedEntityId),
99876652,
$previous);
$previous
);
}
}