Doctrine\ORM\EntityManager::getPartialReference
Gets a partial reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded.
The returned reference may be a partial object if the entity is not yet loaded/managed. If it is a partial object it will not initialize the rest of the entity state on access. Thus you can only ever safely access the identifier of an entity obtained through this method. The use-cases for partial references involve maintaining bidirectional associations without loading one side of the association or to update an entity without loading it. Note, however, that in the latter case the original (persistent) entity data will never be visible to the application (especially not event listeners) as it will never be loaded in the first place.
Signature
public function getPartialReference(string
$entityName,
mixed
$identifier )
Parameters
$entityName
— string- The name of the entity type.
$identifier
— mixed- The entity identifier.
Returns
- The (partial) entity reference.