diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 742a6a6ad..9a4d28284 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -294,8 +294,6 @@ final class DocGeneratorTemplateController extends AbstractController static function () use ($generatedResource) { fpassthru($generatedResource); fclose($generatedResource); - - exit(); }, Response::HTTP_OK, [ diff --git a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php index 7a3e4ac69..98c2ff17d 100644 --- a/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php +++ b/src/Bundle/ChillDocGeneratorBundle/GeneratorDriver/RelatorioDriver.php @@ -46,7 +46,7 @@ class RelatorioDriver implements DriverInterface 'template' => new DataPart($template, $templateName ?? uniqid('template_'), $resourceType), ]; $form = new FormDataPart($formFields); - +dump(json_encode($data)); try { $response = $this->relatorioClient->request('POST', $this->url, [ 'headers' => $form->getPreparedHeaders()->toArray(), diff --git a/src/Bundle/ChillMainBundle/Entity/Center.php b/src/Bundle/ChillMainBundle/Entity/Center.php index 10584bea9..5b25ee119 100644 --- a/src/Bundle/ChillMainBundle/Entity/Center.php +++ b/src/Bundle/ChillMainBundle/Entity/Center.php @@ -38,8 +38,9 @@ class Center implements HasCenterInterface * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @Serializer\Groups({"docgen:read"}) */ - private $id; + private ?int $id = null; /** * @ORM\Column(type="string", length=255) diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php index 4fcad0db8..1821da79d 100644 --- a/src/Bundle/ChillMainBundle/Entity/Civility.php +++ b/src/Bundle/ChillMainBundle/Entity/Civility.php @@ -22,7 +22,7 @@ class Civility { /** * @ORM\Column(type="json") - * @Serializer\Groups({"read"}) + * @Serializer\Groups({"read", "docgen:read"}) */ private array $abbreviation = []; @@ -35,13 +35,13 @@ class Civility * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") - * @Serializer\Groups({"read"}) + * @Serializer\Groups({"read", "docgen:read"}) */ - private $id; + private ?int $id = null; /** * @ORM\Column(type="json") - * @Serializer\Groups({"read"}) + * @Serializer\Groups({"read", "docgen:read"}) */ private array $name = []; diff --git a/src/Bundle/ChillMainBundle/Entity/Scope.php b/src/Bundle/ChillMainBundle/Entity/Scope.php index fc6084883..df5deb7a2 100644 --- a/src/Bundle/ChillMainBundle/Entity/Scope.php +++ b/src/Bundle/ChillMainBundle/Entity/Scope.php @@ -28,24 +28,20 @@ use Symfony\Component\Serializer\Annotation\Groups; class Scope { /** - * @var int - * * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") * @Groups({"read", "docgen:read"}) */ - private $id; + private ?int $id = null; /** * translatable names. * - * @var array - * * @ORM\Column(type="json") * @Groups({"read", "docgen:read"}) */ - private $name = []; + private array $name = []; /** * @var Collection diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 2ed451a92..f5be4793a 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -55,7 +55,6 @@ class User implements AdvancedUserInterface * @var string * * @ORM\Column(type="string", length=150, nullable=true) - * @Serializer\Groups({"docgen:read"}) */ private ?string $email = null; @@ -83,7 +82,6 @@ class User implements AdvancedUserInterface /** * @ORM\Column(type="string", length=200) - * @Serializer\Groups({"docgen:read"}) */ private string $label = ''; @@ -95,7 +93,6 @@ class User implements AdvancedUserInterface /** * @ORM\ManyToOne(targetEntity=Center::class) - * @Serializer\Groups({"docgen:read"}) */ private ?Center $mainCenter = null; diff --git a/src/Bundle/ChillMainBundle/Entity/UserJob.php b/src/Bundle/ChillMainBundle/Entity/UserJob.php index bccba10dd..5f0bea45d 100644 --- a/src/Bundle/ChillMainBundle/Entity/UserJob.php +++ b/src/Bundle/ChillMainBundle/Entity/UserJob.php @@ -32,14 +32,14 @@ class UserJob * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") - * @Serializer\Groups({"read"}) + * @Serializer\Groups({"read", "docgen:read"}) */ protected ?int $id = null; /** * @var array|string[]A * @ORM\Column(name="label", type="json") - * @Serializer\Groups({"read"}) + * @Serializer\Groups({"read", "docgen:read"}) */ protected array $label = []; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index 22219b108..3932bc5e8 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -11,18 +11,31 @@ declare(strict_types=1); namespace Chill\MainBundle\Serializer\Normalizer; +use Chill\MainBundle\Entity\Center; +use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Templating\Entity\UserRender; +use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UserNormalizer implements NormalizerAwareInterface, NormalizerInterface +class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface { use NormalizerAwareTrait; private UserRender $userRender; + const NULL_USER = [ + 'type' => 'user', + 'id' => '', + 'username' => '', + 'text' => '', + 'label' => '', + 'email' => '', + ]; + public function __construct(UserRender $userRender) { $this->userRender = $userRender; @@ -31,20 +44,42 @@ class UserNormalizer implements NormalizerAwareInterface, NormalizerInterface public function normalize($user, ?string $format = null, array $context = []) { /** @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 [ 'type' => 'user', 'id' => $user->getId(), 'username' => $user->getUsername(), 'text' => $this->userRender->renderString($user, []), 'label' => $user->getLabel(), - 'user_job' => $this->normalizer->normalize($user->getUserJob(), $format, $context), - 'main_center' => $this->normalizer->normalize($user->getMainCenter(), $format, $context), - 'main_scope' => $this->normalizer->normalize($user->getMainScope(), $format, $context), + 'email' => $user->getEmail(), + 'user_job' => $this->normalizer->normalize($user->getUserJob(), $format, $userJobContext), + '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; } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index 473f6d75d..3f46a83fe 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -16,6 +16,8 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; +use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\PersonBundle\Templating\Entity\ClosingMotiveRender; use Chill\PersonBundle\Templating\Entity\SocialIssueRender; @@ -89,17 +91,6 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf public function normalize($period, ?string $format = null, array $context = []) { 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) : []; @@ -107,28 +98,45 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf $scopes = [$scopes]; } - return array_merge( - // get a first default data - $initial, - // and add data custom - [ - '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()) : '', - 'closingMotiveText' => null !== $period->getClosingMotive() ? - $this->closingMotiveRender->renderString($period->getClosingMotive(), []) : '', - 'ref' => $user, - '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, - ] - ); + $dateContext = array_merge($context, ['docgen:expects' => DateTime::class, 'groups' => 'docgen:read']); + $userContext = array_merge($context, ['docgen:expects' => User::class, 'groups' => 'docgen:read']); + $participationContext = array_merge($context, ['docgen:expects' => AccompanyingPeriodParticipation::class, 'groups' => 'docgen:read']); + + return [ + 'id' => $period->getId(), + 'closingDate' => $this->normalizer->normalize($period->getClosingDate(), $format, $dateContext), + 'confidential' => $period->isConfidential(), + 'createdAt' => $this->normalizer->normalize($period->getCreatedAt(), $format, $dateContext), + 'createdBy' => $this->normalizer->normalize($period->getCreatedBy(), $format, $userContext), + 'emergency' => $period->isEmergency(), + 'openingDate' => $this->normalizer->normalize($period->getOpeningDate(), $format, $dateContext), + 'origin' => $this->normalizer->normalize($period->getOrigin(), $format, array_merge($context, ['docgen:expects' => AccompanyingPeriod\Origin::class])), + 'participations' => $this->normalizer->normalize($period->getParticipations(), $format, $participationContext), + 'currentParticipations' => $this->normalizer->normalize($period->getCurrentParticipations(), $format, $participationContext), + 'requestorAnonymous' => $period->isRequestorAnonymous(), + 'requestor' => $this->normalizer->normalize($period->getRequestor(), $format, array_merge($context, ['docgen:expects' => Person::class])), + 'resources' => $this->normalizer->normalize($period->getResources(), $format, $context), + 'scopes' => $this->normalizer->normalize($period->getScopes(), $format, array_merge($context, ['docgen:expects' => Scope::class, 'groups' => 'docgen:read'])), + '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) { return self::PERIOD_NULL; } @@ -143,10 +151,10 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf } 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)) { return false; - } + }*/ return true; } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 169236104..d7ae700db 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -64,6 +64,7 @@ class PersonDocGenNormalizer implements } $data = [ + 'kind' => 'person', 'firstname' => $person->getFirstName(), 'lastname' => $person->getLastName(), 'altNames' => implode( diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index c6c4bf136..ae15f2292 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -171,11 +171,11 @@ class AccompanyingPeriodContext implements $options = $template->getOptions(); $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) { 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']); } } diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 19f2062ee..28f1e7b22 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -63,7 +63,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var string * @ORM\Column(name="acronym", type="string", length=64, nullable=true) * @Assert\Length(min="2") - * @Groups({"read", "write"}) + * @Groups({"read", "write", "docgen:read"}) */ private ?string $acronym = ''; @@ -78,7 +78,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address", * cascade={"persist", "remove"}) * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") - * @Groups({"read", "write"}) + * @Groups({"read", "write", "docgen:read"}) */ private ?Address $address = null; @@ -97,6 +97,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\JoinTable(name="chill_3party.thirdparty_category", * joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")}) + * @Groups({"docgen:read"}) */ private Collection $categories; @@ -121,6 +122,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var Civility * @ORM\ManyToOne(targetEntity=Civility::class) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) + * @Groups({"docgen:read", "read"}) */ private ?Civility $civility = null; @@ -131,7 +133,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(name="contact_data_anonymous", type="boolean", options={"default": false}) - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private bool $contactDataAnonymous = false; @@ -149,7 +151,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(name="email", type="string", length=255, nullable=true) * @Assert\Email(checkMX=false) - * @Groups({"read", "write"}) + * @Groups({"read", "write", "docgen:read"}) */ private ?string $email = null; @@ -158,6 +160,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") + * @Groups({"read", "write", "docgen:read"}) */ private ?int $id = null; @@ -171,7 +174,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var string * @ORM\Column(name="name", type="string", length=255) * @Assert\Length(min="2") - * @Groups({"read", "write"}) + * @Groups({"read", "write", "docgen:read"}) */ private ?string $name = ''; @@ -181,7 +184,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var string * @ORM\Column(name="name_company", type="string", length=255, nullable=true) * @Assert\Length(min="3") - * @Groups({"read", "write"}) + * @Groups({"read", "write", "docgen:read"}) */ private ?string $nameCompany = ''; @@ -190,7 +193,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private ?ThirdParty $parent = null; @@ -200,6 +203,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var ThirdPartyProfession * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession") * ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true) + * @Groups({"docgen:read"}) */ 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" * ) * @PhonenumberConstraint(type="any") - * @Groups({"read", "write"}) + * @Groups({"read", "write", "dogen:read"}) */ private ?string $telephone = null; @@ -495,7 +499,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface } /** - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ public function isChild(): bool { diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php index 14cebcb84..7ce362360 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyCategory.php @@ -13,6 +13,7 @@ namespace Chill\ThirdPartyBundle\Entity; use Chill\ThirdPartyBundle\Repository\ThirdPartyCategoryRepository; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation as Serializer; /** * @ORM\Table(name="chill_3party.party_category") @@ -23,19 +24,21 @@ class ThirdPartyCategory /** * @ORM\Column(type="boolean") */ - private $active = true; + private bool $active = true; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") + * @Serializer\Groups({"docgen:read"}) */ - private $id; + private ?int $id = null; /** * @ORM\Column(type="json") + * @Serializer\Groups({"docgen:read"}) */ - private $name = []; + private array $name = []; public function getActive(): ?bool { diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php index e51111624..1963b34a7 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php @@ -13,6 +13,7 @@ namespace Chill\ThirdPartyBundle\Entity; use Chill\ThirdPartyBundle\Repository\ThirdPartyProfessionRepository; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation as Serializer; /** * @ORM\Table(name="chill_3party.party_profession") @@ -23,19 +24,21 @@ class ThirdPartyProfession /** * @ORM\Column(type="boolean") */ - private $active = true; + private bool $active = true; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") + * @Serializer\Groups({"docgen:read"}) */ - private $id; + private ?int $id = null; /** * @ORM\Column(type="json") + * @Serializer\Groups({"docgen:read"}) */ - private $name = []; + private array $name = []; public function getActive(): ?bool {