improve docgen wip

This commit is contained in:
Julien Fastré 2021-12-10 01:10:55 +01:00
parent e266fa0e5d
commit 9004686a13
14 changed files with 123 additions and 77 deletions

View File

@ -294,8 +294,6 @@ final class DocGeneratorTemplateController extends AbstractController
static function () use ($generatedResource) { static function () use ($generatedResource) {
fpassthru($generatedResource); fpassthru($generatedResource);
fclose($generatedResource); fclose($generatedResource);
exit();
}, },
Response::HTTP_OK, Response::HTTP_OK,
[ [

View File

@ -46,7 +46,7 @@ class RelatorioDriver implements DriverInterface
'template' => new DataPart($template, $templateName ?? uniqid('template_'), $resourceType), 'template' => new DataPart($template, $templateName ?? uniqid('template_'), $resourceType),
]; ];
$form = new FormDataPart($formFields); $form = new FormDataPart($formFields);
dump(json_encode($data));
try { try {
$response = $this->relatorioClient->request('POST', $this->url, [ $response = $this->relatorioClient->request('POST', $this->url, [
'headers' => $form->getPreparedHeaders()->toArray(), 'headers' => $form->getPreparedHeaders()->toArray(),

View File

@ -38,8 +38,9 @@ class Center implements HasCenterInterface
* @ORM\Id * @ORM\Id
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO") * @ORM\GeneratedValue(strategy="AUTO")
* @Serializer\Groups({"docgen:read"})
*/ */
private $id; private ?int $id = null;
/** /**
* @ORM\Column(type="string", length=255) * @ORM\Column(type="string", length=255)

View File

@ -22,7 +22,7 @@ class Civility
{ {
/** /**
* @ORM\Column(type="json") * @ORM\Column(type="json")
* @Serializer\Groups({"read"}) * @Serializer\Groups({"read", "docgen:read"})
*/ */
private array $abbreviation = []; private array $abbreviation = [];
@ -35,13 +35,13 @@ class Civility
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
* @Serializer\Groups({"read"}) * @Serializer\Groups({"read", "docgen:read"})
*/ */
private $id; private ?int $id = null;
/** /**
* @ORM\Column(type="json") * @ORM\Column(type="json")
* @Serializer\Groups({"read"}) * @Serializer\Groups({"read", "docgen:read"})
*/ */
private array $name = []; private array $name = [];

View File

@ -28,24 +28,20 @@ use Symfony\Component\Serializer\Annotation\Groups;
class Scope class Scope
{ {
/** /**
* @var int
*
* @ORM\Id * @ORM\Id
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO") * @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"read", "docgen:read"}) * @Groups({"read", "docgen:read"})
*/ */
private $id; private ?int $id = null;
/** /**
* translatable names. * translatable names.
* *
* @var array
*
* @ORM\Column(type="json") * @ORM\Column(type="json")
* @Groups({"read", "docgen:read"}) * @Groups({"read", "docgen:read"})
*/ */
private $name = []; private array $name = [];
/** /**
* @var Collection * @var Collection

View File

@ -55,7 +55,6 @@ class User implements AdvancedUserInterface
* @var string * @var string
* *
* @ORM\Column(type="string", length=150, nullable=true) * @ORM\Column(type="string", length=150, nullable=true)
* @Serializer\Groups({"docgen:read"})
*/ */
private ?string $email = null; private ?string $email = null;
@ -83,7 +82,6 @@ class User implements AdvancedUserInterface
/** /**
* @ORM\Column(type="string", length=200) * @ORM\Column(type="string", length=200)
* @Serializer\Groups({"docgen:read"})
*/ */
private string $label = ''; private string $label = '';
@ -95,7 +93,6 @@ class User implements AdvancedUserInterface
/** /**
* @ORM\ManyToOne(targetEntity=Center::class) * @ORM\ManyToOne(targetEntity=Center::class)
* @Serializer\Groups({"docgen:read"})
*/ */
private ?Center $mainCenter = null; private ?Center $mainCenter = null;

View File

@ -32,14 +32,14 @@ class UserJob
* @ORM\Id * @ORM\Id
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO") * @ORM\GeneratedValue(strategy="AUTO")
* @Serializer\Groups({"read"}) * @Serializer\Groups({"read", "docgen:read"})
*/ */
protected ?int $id = null; protected ?int $id = null;
/** /**
* @var array|string[]A * @var array|string[]A
* @ORM\Column(name="label", type="json") * @ORM\Column(name="label", type="json")
* @Serializer\Groups({"read"}) * @Serializer\Groups({"read", "docgen:read"})
*/ */
protected array $label = []; protected array $label = [];

View File

@ -11,18 +11,31 @@ declare(strict_types=1);
namespace Chill\MainBundle\Serializer\Normalizer; namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Templating\Entity\UserRender; use Chill\MainBundle\Templating\Entity\UserRender;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class UserNormalizer implements NormalizerAwareInterface, NormalizerInterface class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
{ {
use NormalizerAwareTrait; use NormalizerAwareTrait;
private UserRender $userRender; private UserRender $userRender;
const NULL_USER = [
'type' => 'user',
'id' => '',
'username' => '',
'text' => '',
'label' => '',
'email' => '',
];
public function __construct(UserRender $userRender) public function __construct(UserRender $userRender)
{ {
$this->userRender = $userRender; $this->userRender = $userRender;
@ -31,20 +44,42 @@ class UserNormalizer implements NormalizerAwareInterface, NormalizerInterface
public function normalize($user, ?string $format = null, array $context = []) public function normalize($user, ?string $format = null, array $context = [])
{ {
/** @var User $user */ /** @var User $user */
$userJobContext = array_merge(
$context, ['docgen:expects' => UserJob::class, 'groups' => 'docgen:read']);
$scopeContext = array_merge(
$context, ['docgen:expects' => Scope::class, 'groups' => 'docgen:read']);
$centerContext = array_merge(
$context, ['docgen:expects' => Center::class, 'groups' => 'docgen:read']);
if (null === $user && 'docgen' === $format) {
return array_merge(self::NULL_USER, [
'user_job' => $this->normalizer->normalize(null, $format, $userJobContext),
'main_center' => $this->normalizer->normalize(null, $format, $centerContext),
'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext),
]);
}
return [ return [
'type' => 'user', 'type' => 'user',
'id' => $user->getId(), 'id' => $user->getId(),
'username' => $user->getUsername(), 'username' => $user->getUsername(),
'text' => $this->userRender->renderString($user, []), 'text' => $this->userRender->renderString($user, []),
'label' => $user->getLabel(), 'label' => $user->getLabel(),
'user_job' => $this->normalizer->normalize($user->getUserJob(), $format, $context), 'email' => $user->getEmail(),
'main_center' => $this->normalizer->normalize($user->getMainCenter(), $format, $context), 'user_job' => $this->normalizer->normalize($user->getUserJob(), $format, $userJobContext),
'main_scope' => $this->normalizer->normalize($user->getMainScope(), $format, $context), 'main_center' => $this->normalizer->normalize($user->getMainCenter(), $format, $centerContext),
'main_scope' => $this->normalizer->normalize($user->getMainScope(), $format, $scopeContext),
]; ];
} }
public function supportsNormalization($data, ?string $format = null): bool public function supportsNormalization($data, ?string $format = null, array $context = []): bool
{ {
return $data instanceof User && ('json' === $format || 'docgen' === $format); if ($data instanceof User && ('json' === $format || 'docgen' === $format)) {
return true;
}
if (null === $data && 'docgen' === $format && User::class === ($context['docgen:expects'] ?? null)) {
return true;
}
return false;
} }
} }

View File

@ -16,6 +16,8 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher; use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\PersonBundle\Templating\Entity\ClosingMotiveRender; use Chill\PersonBundle\Templating\Entity\ClosingMotiveRender;
use Chill\PersonBundle\Templating\Entity\SocialIssueRender; use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
@ -89,17 +91,6 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
public function normalize($period, ?string $format = null, array $context = []) public function normalize($period, ?string $format = null, array $context = [])
{ {
if ($period instanceof AccompanyingPeriod) { if ($period instanceof AccompanyingPeriod) {
$ignored = $context[self::IGNORE_FIRST_PASS_KEY] ?? [];
$ignored[] = spl_object_hash($period);
$initial =
$this->normalizer->normalize($period, $format, array_merge(
$context,
[self::IGNORE_FIRST_PASS_KEY => $ignored, AbstractNormalizer::GROUPS => 'docgen:read']
));
// some transformation
$user = $initial['user'];
unset($initial['user']);
$scopes = $this->scopeResolverDispatcher->isConcerned($period) ? $this->scopeResolverDispatcher->resolveScope($period) : []; $scopes = $this->scopeResolverDispatcher->isConcerned($period) ? $this->scopeResolverDispatcher->resolveScope($period) : [];
@ -107,28 +98,45 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
$scopes = [$scopes]; $scopes = [$scopes];
} }
return array_merge( $dateContext = array_merge($context, ['docgen:expects' => DateTime::class, 'groups' => 'docgen:read']);
// get a first default data $userContext = array_merge($context, ['docgen:expects' => User::class, 'groups' => 'docgen:read']);
$initial, $participationContext = array_merge($context, ['docgen:expects' => AccompanyingPeriodParticipation::class, 'groups' => 'docgen:read']);
// and add data custom
[ return [
'intensity' => $this->translator->trans($period->getIntensity()), 'id' => $period->getId(),
'step' => $this->translator->trans('accompanying_period.' . $period->getStep()), 'closingDate' => $this->normalizer->normalize($period->getClosingDate(), $format, $dateContext),
'emergencyText' => $period->isEmergency() ? $this->translator->trans('accompanying_period.emergency') : '', 'confidential' => $period->isConfidential(),
'confidentialText' => $period->isConfidential() ? $this->translator->trans('confidential') : '', 'createdAt' => $this->normalizer->normalize($period->getCreatedAt(), $format, $dateContext),
//'originText' => null !== $period->getOrigin() ? $this->translatableStringHelper->localize($period->getOrigin()->getLabel()) : '', 'createdBy' => $this->normalizer->normalize($period->getCreatedBy(), $format, $userContext),
'closingMotiveText' => null !== $period->getClosingMotive() ? 'emergency' => $period->isEmergency(),
$this->closingMotiveRender->renderString($period->getClosingMotive(), []) : '', 'openingDate' => $this->normalizer->normalize($period->getOpeningDate(), $format, $dateContext),
'ref' => $user, 'origin' => $this->normalizer->normalize($period->getOrigin(), $format, array_merge($context, ['docgen:expects' => AccompanyingPeriod\Origin::class])),
'socialIssuesText' => implode(', ', array_map(function (SocialIssue $s) { 'participations' => $this->normalizer->normalize($period->getParticipations(), $format, $participationContext),
return $this->socialIssueRender->renderString($s, []); 'currentParticipations' => $this->normalizer->normalize($period->getCurrentParticipations(), $format, $participationContext),
}, $period->getSocialIssues()->toArray())), 'requestorAnonymous' => $period->isRequestorAnonymous(),
'scopesText' => implode(', ', array_map(function (Scope $s) { 'requestor' => $this->normalizer->normalize($period->getRequestor(), $format, array_merge($context, ['docgen:expects' => Person::class])),
return $this->translatableStringHelper->localize($s->getName()); 'resources' => $this->normalizer->normalize($period->getResources(), $format, $context),
}, $scopes)), 'scopes' => $this->normalizer->normalize($period->getScopes(), $format, array_merge($context, ['docgen:expects' => Scope::class, 'groups' => 'docgen:read'])),
'scopes' => $scopes, 'socialIssues' => $this->normalizer->normalize($period->getSocialIssues(), $format, $context),
] 'intensity' => $this->translator->trans($period->getIntensity()),
); 'step' => $this->translator->trans('accompanying_period.' . $period->getStep()),
'emergencyText' => $period->isEmergency() ? $this->translator->trans('accompanying_period.emergency') : '',
'confidentialText' => $period->isConfidential() ? $this->translator->trans('confidential') : '',
//'originText' => null !== $period->getOrigin() ? $this->translatableStringHelper->localize($period->getOrigin()->getLabel()) : '',
'isClosed' => $period->getClosingDate() !== null,
'closingMotiveText' => null !== $period->getClosingMotive() ?
$this->closingMotiveRender->renderString($period->getClosingMotive(), []) : '',
'ref' => $this->normalizer->normalize($period->getUser(), $format, $userContext),
'hasRef' => $period->getUser() !== null,
'socialIssuesText' => implode(', ', array_map(function (SocialIssue $s) {
return $this->socialIssueRender->renderString($s, []);
}, $period->getSocialIssues()->toArray())),
'scopesText' => implode(', ', array_map(function (Scope $s) {
return $this->translatableStringHelper->localize($s->getName());
}, $scopes)),
//'scopes' => $scopes,
'hasRequestor' => $period->getRequestor() !== null,
];
} elseif (null === $period) { } elseif (null === $period) {
return self::PERIOD_NULL; return self::PERIOD_NULL;
} }
@ -143,10 +151,10 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
} }
if ($data instanceof AccompanyingPeriod) { if ($data instanceof AccompanyingPeriod) {
if (array_key_exists(self::IGNORE_FIRST_PASS_KEY, $context) /*if (array_key_exists(self::IGNORE_FIRST_PASS_KEY, $context)
&& in_array(spl_object_hash($data), $context[self::IGNORE_FIRST_PASS_KEY], true)) { && in_array(spl_object_hash($data), $context[self::IGNORE_FIRST_PASS_KEY], true)) {
return false; return false;
} }*/
return true; return true;
} }

View File

@ -64,6 +64,7 @@ class PersonDocGenNormalizer implements
} }
$data = [ $data = [
'kind' => 'person',
'firstname' => $person->getFirstName(), 'firstname' => $person->getFirstName(),
'lastname' => $person->getLastName(), 'lastname' => $person->getLastName(),
'altNames' => implode( 'altNames' => implode(

View File

@ -171,11 +171,11 @@ class AccompanyingPeriodContext implements
$options = $template->getOptions(); $options = $template->getOptions();
$data = []; $data = [];
$data['course'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => AccompanyingPeriod::class]); $data['course'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']);
foreach (['mainPerson', 'person1', 'person2'] as $k) { foreach (['mainPerson', 'person1', 'person2'] as $k) {
if ($options[$k]) { if ($options[$k]) {
$data[$k] = $this->normalizer->normalize($contextGenerationData[$k], 'docgen', ['docgen:expects' => Person::class]); $data[$k] = $this->normalizer->normalize($contextGenerationData[$k], 'docgen', ['docgen:expects' => Person::class, 'groups' => 'docgen:read']);
} }
} }

View File

@ -63,7 +63,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @var string * @var string
* @ORM\Column(name="acronym", type="string", length=64, nullable=true) * @ORM\Column(name="acronym", type="string", length=64, nullable=true)
* @Assert\Length(min="2") * @Assert\Length(min="2")
* @Groups({"read", "write"}) * @Groups({"read", "write", "docgen:read"})
*/ */
private ?string $acronym = ''; private ?string $acronym = '';
@ -78,7 +78,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address", * @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove"}) * cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
* @Groups({"read", "write"}) * @Groups({"read", "write", "docgen:read"})
*/ */
private ?Address $address = null; private ?Address $address = null;
@ -97,6 +97,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @ORM\JoinTable(name="chill_3party.thirdparty_category", * @ORM\JoinTable(name="chill_3party.thirdparty_category",
* joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")}, * joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")}) * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")})
* @Groups({"docgen:read"})
*/ */
private Collection $categories; private Collection $categories;
@ -121,6 +122,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @var Civility * @var Civility
* @ORM\ManyToOne(targetEntity=Civility::class) * @ORM\ManyToOne(targetEntity=Civility::class)
* ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
* @Groups({"docgen:read", "read"})
*/ */
private ?Civility $civility = null; private ?Civility $civility = null;
@ -131,7 +133,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/** /**
* @ORM\Column(name="contact_data_anonymous", type="boolean", options={"default": false}) * @ORM\Column(name="contact_data_anonymous", type="boolean", options={"default": false})
* @Groups({"read"}) * @Groups({"read", "docgen:read"})
*/ */
private bool $contactDataAnonymous = false; private bool $contactDataAnonymous = false;
@ -149,7 +151,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/** /**
* @ORM\Column(name="email", type="string", length=255, nullable=true) * @ORM\Column(name="email", type="string", length=255, nullable=true)
* @Assert\Email(checkMX=false) * @Assert\Email(checkMX=false)
* @Groups({"read", "write"}) * @Groups({"read", "write", "docgen:read"})
*/ */
private ?string $email = null; private ?string $email = null;
@ -158,6 +160,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO") * @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"read", "write", "docgen:read"})
*/ */
private ?int $id = null; private ?int $id = null;
@ -171,7 +174,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @var string * @var string
* @ORM\Column(name="name", type="string", length=255) * @ORM\Column(name="name", type="string", length=255)
* @Assert\Length(min="2") * @Assert\Length(min="2")
* @Groups({"read", "write"}) * @Groups({"read", "write", "docgen:read"})
*/ */
private ?string $name = ''; private ?string $name = '';
@ -181,7 +184,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @var string * @var string
* @ORM\Column(name="name_company", type="string", length=255, nullable=true) * @ORM\Column(name="name_company", type="string", length=255, nullable=true)
* @Assert\Length(min="3") * @Assert\Length(min="3")
* @Groups({"read", "write"}) * @Groups({"read", "write", "docgen:read"})
*/ */
private ?string $nameCompany = ''; private ?string $nameCompany = '';
@ -190,7 +193,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* *
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children") * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
* @Groups({"read"}) * @Groups({"read", "docgen:read"})
*/ */
private ?ThirdParty $parent = null; private ?ThirdParty $parent = null;
@ -200,6 +203,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @var ThirdPartyProfession * @var ThirdPartyProfession
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession") * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
* ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true) * ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true)
* @Groups({"docgen:read"})
*/ */
private ?ThirdPartyProfession $profession = null; private ?ThirdPartyProfession $profession = null;
@ -209,7 +213,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* message="Invalid phone number: it should begin with the international prefix starting with ""+"", hold only digits and be smaller than 20 characters. Ex: +33123456789" * message="Invalid phone number: it should begin with the international prefix starting with ""+"", hold only digits and be smaller than 20 characters. Ex: +33123456789"
* ) * )
* @PhonenumberConstraint(type="any") * @PhonenumberConstraint(type="any")
* @Groups({"read", "write"}) * @Groups({"read", "write", "dogen:read"})
*/ */
private ?string $telephone = null; private ?string $telephone = null;
@ -495,7 +499,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
} }
/** /**
* @Groups({"read"}) * @Groups({"read", "docgen:read"})
*/ */
public function isChild(): bool public function isChild(): bool
{ {

View File

@ -13,6 +13,7 @@ namespace Chill\ThirdPartyBundle\Entity;
use Chill\ThirdPartyBundle\Repository\ThirdPartyCategoryRepository; use Chill\ThirdPartyBundle\Repository\ThirdPartyCategoryRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/** /**
* @ORM\Table(name="chill_3party.party_category") * @ORM\Table(name="chill_3party.party_category")
@ -23,19 +24,21 @@ class ThirdPartyCategory
/** /**
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
private $active = true; private bool $active = true;
/** /**
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
* @Serializer\Groups({"docgen:read"})
*/ */
private $id; private ?int $id = null;
/** /**
* @ORM\Column(type="json") * @ORM\Column(type="json")
* @Serializer\Groups({"docgen:read"})
*/ */
private $name = []; private array $name = [];
public function getActive(): ?bool public function getActive(): ?bool
{ {

View File

@ -13,6 +13,7 @@ namespace Chill\ThirdPartyBundle\Entity;
use Chill\ThirdPartyBundle\Repository\ThirdPartyProfessionRepository; use Chill\ThirdPartyBundle\Repository\ThirdPartyProfessionRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/** /**
* @ORM\Table(name="chill_3party.party_profession") * @ORM\Table(name="chill_3party.party_profession")
@ -23,19 +24,21 @@ class ThirdPartyProfession
/** /**
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
private $active = true; private bool $active = true;
/** /**
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
* @Serializer\Groups({"docgen:read"})
*/ */
private $id; private ?int $id = null;
/** /**
* @ORM\Column(type="json") * @ORM\Column(type="json")
* @Serializer\Groups({"docgen:read"})
*/ */
private $name = []; private array $name = [];
public function getActive(): ?bool public function getActive(): ?bool
{ {