Revert "Feature: [docgen][stored object] handler for request generator and required fixes"

This reverts commit 91d21ba939.
This commit is contained in:
2023-02-16 14:08:11 +01:00
parent 7c4bc8f46a
commit 9676975cd8
18 changed files with 111 additions and 308 deletions

View File

@@ -21,13 +21,11 @@ use Chill\DocStoreBundle\Repository\DocumentCategoryRepository;
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Form\Type\ScopePickerType;
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Repository\PersonRepository;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
@@ -57,8 +55,6 @@ final class PersonContext implements PersonContextInterface
private NormalizerInterface $normalizer;
private ScopeRepositoryInterface $scopeRepository;
private Security $security;
private bool $showScopes;
@@ -75,7 +71,6 @@ final class PersonContext implements PersonContextInterface
EntityManagerInterface $em,
NormalizerInterface $normalizer,
ParameterBagInterface $parameterBag,
ScopeRepositoryInterface $scopeRepository,
Security $security,
TranslatorInterface $translator,
TranslatableStringHelperInterface $translatableStringHelper
@@ -86,7 +81,6 @@ final class PersonContext implements PersonContextInterface
$this->documentCategoryRepository = $documentCategoryRepository;
$this->em = $em;
$this->normalizer = $normalizer;
$this->scopeRepository = $scopeRepository;
$this->security = $security;
$this->showScopes = $parameterBag->get('chill_main')['acl']['form_show_scopes'];
$this->translator = $translator;
@@ -217,38 +211,6 @@ final class PersonContext implements PersonContextInterface
return true;
}
/**
* @param Person $entity
*/
public function publicFormTransform(DocGeneratorTemplate $template, $entity, array $data): array
{
$scope = $data['scope'] ?? null;
return [
'title' => $data['title'] ?? '',
'scope_id' => $scope instanceof Scope ? $scope->getId() : null,
];
}
/**
* @param Person $entity
*/
public function publicFormReverseTransform(DocGeneratorTemplate $template, $entity, array $data): array
{
if (!isset($data['scope'])) {
$scope = null;
} else {
if (null === $scope = $this->scopeRepository->find($data['scope'])) {
throw new \UnexpectedValueException('scope not found');
}
}
return [
'title' => $data['title'] ?? '',
'scope' => $scope,
];
}
/**
* @param Person $entity
*/