-
-
Notifications
You must be signed in to change notification settings - Fork 515
Open
Description
Sorry about necroposting, but after upgrading to 2.11 recently, I think we have stumbled onto this and it's causing a "bug" in our code. I used quotes because I am not sure if our observed behavior is a bug or works-as-intended.
Our simplified scenario:
DocumenthasmappedPropertyandunmappedProperty- When the document is fetched from the database in its lazy state,
unmappedPropertyisnull - We have a service that inserts stuff into the
unmappedPropertywhen the document is loaded:#[AsDocumentListener(event: Events::postLoad)] (...) - Our assumption (which seems to have broken with this PR) is that when we access any property, we can rely on the document to get fully loaded.
- In order to work around this, we had to resort to make a "dummy fetch" to force the loading.
class Document
{
private int $mappedProperty;
private ServiceInterface $unmappedProperty;
public function getUnmappedProperty()
{
$this->mappedProperty; // Dummy call to get proxy to initialize
return $this->unmappedProperty;
}
/**
* Called from a listener on Events::postLoad
*/
public function initialize(ServiceInterface $service)
{
$this->unmappedProperty = $service;
}
}Is this expected? Is our (admittedly awkward) scenario unsupported? Or should I open an issue with this?
Originally posted by @melkamar in #2698 (comment)
melkamar
Metadata
Metadata
Assignees
Labels
No labels