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
Unsure if this is something already aware of. But we found out today that if a property on an object is marked private, when fetching that document from the database, the field will fail to be serialised. You can see this by testing the value of 114 of the JsonDocumentType.
I can add more context if needed, but if this is to be expected, maybe a note could be added to the documentation. I'd be happy to do so if this is indeed something you'd like.
In the below example, the value of dismissedWelcomeCardAt will return null when fetched from the database unless the property is public.
Document field on our User entity:
<?php
declare(strict_types=1);
namespace App\Entity\User;
use App\Entity\User\Preferences\UserOnboardingPreferences;
class UserPreferences
{
private UserOnboardingPreferences $userOnboardingPreferences;
public function __construct()
{
$this->userOnboardingPreferences = new UserOnboardingPreferences();
}
public function getUserOnboardingPreferences(): UserOnboardingPreferences
{
return $this->userOnboardingPreferences;
}
public function setUserOnboardingPreferences(UserOnboardingPreferences $userOnboardingPreferences): void
{
$this->userOnboardingPreferences = $userOnboardingPreferences;
}
}
Nested onboarding object:
<?php
declare(strict_types=1);
namespace App\Entity\User\Preferences;
use DateTime;
class UserOnboardingPreferences
{
private ?DateTime $dismissedWelcomeCardAt = null;
public function getDismissedWelcomeCardAt(): ?DateTime
{
return $this->dismissedWelcomeCardAt;
}
public function dismissWelcomeCard(): void
{
$this->dismissedWelcomeCardAt = new DateTime();
}
public function hasDismissedWelcomeCard(): bool
{
return $this->getDismissedWelcomeCardAt() !== null;
}
}
The text was updated successfully, but these errors were encountered:
Unsure if this is something already aware of. But we found out today that if a property on an object is marked private, when fetching that document from the database, the field will fail to be serialised. You can see this by testing the value of 114 of the JsonDocumentType.
I can add more context if needed, but if this is to be expected, maybe a note could be added to the documentation. I'd be happy to do so if this is indeed something you'd like.
In the below example, the value of
dismissedWelcomeCardAt
will returnnull
when fetched from the database unless the property is public.Document field on our User entity:
Nested onboarding object:
The text was updated successfully, but these errors were encountered: