Details
Description
Support for @EntityListeners
Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them.
The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass.
The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...)
Example :
/**
* @EntityListeners({"ContractSubscriber"})
*/
class CompanyContract
{
}
class ContractSubscriber
{
/**
* @PrePersist
*/
public function prePersistHandler(CompanyContract $contract)
{
// do something
}
/**
* @PostPersist
* Most of cases just the entity is needed.
* as a second parameter LifecycleEventArgs allow access to the entity manager.
*/
public function postPersistHandler(CompanyContract $contract, LifecycleEventArgs $args)
{
// do something
}
}
$contract = new CompanyFlexContract();
// do something
$em->persist($contract);
Activity
Fabio B. Silva
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
Support for @EntityListeners
Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them. The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass. The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...) Example : {code} /** * @EntityListeners({"ContractSubscriber"}) */ class CompanyContract { } class ContractSubscriber { /** * @PostPersist */ public function persistHandler(CompanyContract $contract) { // do something } } $contract = new CompanyFlexContract(); // do something $em->persist($contract); {code} |
Support for @EntityListeners
Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them. The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass. The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...) Example : {code} /** * @EntityListeners({"ContractSubscriber"}) */ class CompanyContract { } class ContractSubscriber { /** * @PrePersist */ public function prePersistHandler(CompanyContract $contract) { // do something } /** * @PostPersist * Most of cases the entity just is needed. * as a second parameter LifecycleEventArgs allow access to the entity manager. */ public function postPersistHandler(CompanyContract $contract) { // do something } } $contract = new CompanyFlexContract(); // do something $em->persist($contract); {code} |
Fabio B. Silva
made changes -
| Description |
Support for @EntityListeners
Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them. The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass. The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...) Example : {code} /** * @EntityListeners({"ContractSubscriber"}) */ class CompanyContract { } class ContractSubscriber { /** * @PrePersist */ public function prePersistHandler(CompanyContract $contract) { // do something } /** * @PostPersist * Most of cases the entity just is needed. * as a second parameter LifecycleEventArgs allow access to the entity manager. */ public function postPersistHandler(CompanyContract $contract) { // do something } } $contract = new CompanyFlexContract(); // do something $em->persist($contract); {code} |
Support for @EntityListeners
Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them. The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass. The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...) Example : {code} /** * @EntityListeners({"ContractSubscriber"}) */ class CompanyContract { } class ContractSubscriber { /** * @PrePersist */ public function prePersistHandler(CompanyContract $contract) { // do something } /** * @PostPersist * Most of cases the entity just is needed. * as a second parameter LifecycleEventArgs allow access to the entity manager. */ public function postPersistHandler(CompanyContract $contract, LifecycleEventArgs $args) { // do something } } $contract = new CompanyFlexContract(); // do something $em->persist($contract); {code} |
Fabio B. Silva
made changes -
| Description |
Support for @EntityListeners
Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them. The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass. The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...) Example : {code} /** * @EntityListeners({"ContractSubscriber"}) */ class CompanyContract { } class ContractSubscriber { /** * @PrePersist */ public function prePersistHandler(CompanyContract $contract) { // do something } /** * @PostPersist * Most of cases the entity just is needed. * as a second parameter LifecycleEventArgs allow access to the entity manager. */ public function postPersistHandler(CompanyContract $contract, LifecycleEventArgs $args) { // do something } } $contract = new CompanyFlexContract(); // do something $em->persist($contract); {code} |
Support for @EntityListeners
Now subscribers are called for ALL entities, to increase the performance we should allow the configuration listeners for entities that need them. The @EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass. The @EntityListeners annotation may be applied to an entity class or mapped superclass. The listenner callbacks methods are annotated by the current callback annotations (@PreUpdate, @PrePersist, etc...) Example : {code} /** * @EntityListeners({"ContractSubscriber"}) */ class CompanyContract { } class ContractSubscriber { /** * @PrePersist */ public function prePersistHandler(CompanyContract $contract) { // do something } /** * @PostPersist * Most of cases just the entity is needed. * as a second parameter LifecycleEventArgs allow access to the entity manager. */ public function postPersistHandler(CompanyContract $contract, LifecycleEventArgs $args) { // do something } } $contract = new CompanyFlexContract(); // do something $em->persist($contract); {code} |
Fabio B. Silva
made changes -
| Status | Open [ 1 ] | In Progress [ 3 ] |
Fabio B. Silva
made changes -
| Status | In Progress [ 3 ] | Resolved [ 5 ] |
| Fix Version/s | 2.4 [ 10321 ] | |
| Resolution | Fixed [ 1 ] |