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
Where value for $changedAt comes from joined table:
SELECT
pt.*,
l.changed_atFROM primary_table pt
LEFT JOIN (SELECTl.change_atFROM ... )
When given entity is being persisted, these extended properties are marked as virtual to avoid ORM attempting to persist them. After persisting they are reset.
// Required for correct behavior on persisting values not present in mapper DB tablepublicfunctiononBeforeInsert(): void
{
parent::onBeforeInsert();
$this->metadata->getProperty('changedAt')->isVirtual = true;
$this->metadata->getProperty('changedBy')->isVirtual = true;
}
publicfunctiononAfterInsert(): void
{
parent::onAfterInsert();
$this->metadata->getProperty('changedAt')->isVirtual = false;
$this->metadata->getProperty('changedBy')->isVirtual = false;
}
I don't remember exactly why it was implemented this way, but it was the only solution we came with.
As PHP 8.4 comes with property hooks we could remove virtual properties, as they would be completely modelled
by a custom property with getter hook.
This:
Would become
Please note, that this would not mean removing custom getters/setters support, as they're still needed for non-virtual properties.
The text was updated successfully, but these errors were encountered: