PersistentObject base class that implements getter/setter methods for all mapped fields and associations by overriding __call.
This class is a forward compatible implementation of the PersistentObject trait.
- All persistent objects have to be associated with a single EntityManager, multiple
EntityManagers are not supported. You can set the EntityManager with
- Setters and getters only work if a ClassMetadata instance was injected into the PersistentObject.
This is either done on
postLoadof an object or by accessing the global object manager.
- There are no hooks for setters/getters. Just implement the method yourself instead of relying on __call().
- Slower than handcoded implementations: An average of 7 method calls per access to a field and 11 for an association.
- Only the inverse side associations get autoset on the owning side as well. Setting objects on the owning side will not set the inverse side associations.
at line 60
setEntityManager(EntityManagerInterface|null $entityManager = null)
Sets the entity manager responsible for all persistent object base classes.
at line 78
injectEntityManager(EntityManagerInterface $entityManager, ClassMetadata $classMetadata)
Injects the Doctrine Object Manager.
at line 244
__call(string $method, mixed $args)