mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-424: Remove EventArgs::getEmptyInstance() #528
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Mar 14, 2010).
Jira issue originally created by user shurakai:
I can't see what this method is good for? It is only used in the EventManager (line 61) and I think using "new EventArgs()" instead would be equivalent?
Thanks for clarification.
@doctrinebot commented on GitHub (Mar 15, 2010):
Comment created by romanb:
Every event that does not need a special EventArgs instance because it doesnt carry any additional event information can use this instance, which is much more efficient than creating a new instance every time. Any event can be dispatched via: $evm->dispatchEvent(Events::foo); and this will automatically re-use the immutable, empty instance.
To answer your question, yes using "new EventArgs()" would be quivalent but would use X objects (where X can quickly become very large) instead of 1. Since the empty instance is immutable it is safe to share it.
@doctrinebot commented on GitHub (Mar 15, 2010):
Issue was closed with resolution "Invalid"
@doctrinebot commented on GitHub (Mar 15, 2010):
Comment created by romanb:
(The concept is from .NET btw :) http://msdn.microsoft.com/en-us/library/system.eventargs.empty.aspx )
@doctrinebot commented on GitHub (Mar 15, 2010):
Comment created by shurakai:
Thanks for clarifying! I've added some documentation stating this exact purpose, maybe someone will find it helpful.
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/58632c7c43c07b080ac8