You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[SerializedName('is_kyc_completed')]
private bool $isKycCompleted = false;
public function isKycCompleted(): bool
{
return $this->isKycCompleted;
}
public function setIsKycCompleted(bool $isKycCompleted): void
{
$this->isKycCompleted = $isKycCompleted;
}
$classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());
$metadataAwareNameConverter = new MetadataAwareNameConverter($classMetadataFactory);
$serializer = new Serializer(
[
new DateTimeNormalizer(),
//new SellerSalesChannelNormalizer($this->normalizer),
new ObjectNormalizer($classMetadataFactory, $metadataAwareNameConverter)],
['json' => new JsonEncoder()]
);
$serializer->serialize(
$body,
'json',
[
AbstractObjectNormalizer::SKIP_NULL_VALUES => true,
AbstractNormalizer::IGNORED_ATTRIBUTES => ['passwordHasherName'],
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function () {
return [];
},
//SellerSalesChannelNormalizer::KYC_COMPLETED_RENAME => true,
]
)
If I do not use SellerSalesChannelNormalizer then it serializes this property name to
'kycCompleted' .
If I change getter to like getIsKycCompleted() then it serializes to is_kyc_completed - as in SerializedName attribute.
With custom normalized I fix it but that is additional code which I expect should not be needed.
Yea I see I could avoid custom normalizer by renaming getter to getIsKycCompleted, maybe I should choose this option but still even this is not expected to be needed.
Additional context
No response
The text was updated successfully, but these errors were encountered:
darius-v
changed the title
[Question]: Why #[SerializedName is ignored when method name matches property?
[Question]: Why #[SerializedName('is_kyc_completed')] is ignored when method name matches property?
Jan 15, 2025
Also similar problem - field does not appear in the doc when getter does not match property. Why? WHat getter has to do with this when all we do are writing near property?
public function getFBPOffer(): ?FBPOffer
{
return $this->fbpOffer;
}
this adds field to response documentation:
public function getFbpOffer(): ?FBPOffer
{
return $this->fbpOffer;
}
Version
4.33.4
Question
If I do not use SellerSalesChannelNormalizer then it serializes this property name to
'kycCompleted' .
If I change getter to like getIsKycCompleted() then it serializes to is_kyc_completed - as in SerializedName attribute.
With custom normalized I fix it but that is additional code which I expect should not be needed.
Yea I see I could avoid custom normalizer by renaming getter to getIsKycCompleted, maybe I should choose this option but still even this is not expected to be needed.
Additional context
No response
The text was updated successfully, but these errors were encountered: