-
-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add base events class #335
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DCOM-250 We use Jira to track the state of pull requests and the versions they got |
the events are related to the persistence layer only. So if we provide constants in doctrine common for the event names, they should live somewhere in the Persistence subnamespace, not at the root |
agree with @stof it should live in |
@@ -0,0 +1,82 @@ | |||
<?php | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please insert the Doctrine file doc comment here? You can copy it from some other class.
I would actually include the other events as well, even if the CouchDB ODM does not trigger them currently (the CouchDB ODM is not very actively maintained AFAIK |
@stof do you think it would be good to add a private constructor here just like in ORM events for example so that the class is not instantiable? |
@deeky666 This class could be an interface instead, as interfaces can contains constants. |
I updated the code in order to match your recommendations. I made it an interface as the class can not be instantiated and made the constant names PSR2 complaint. I added the missing events, as I did not include phpcr list so, like |
namespace Doctrine\Common\Persistence; | ||
|
||
/** | ||
* Container for all ORM events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this description a bit misleading here? I thought the purpose of this container is to provide common persistence events in general and not ORM specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it should saypersistence events
. The phpdoc is probably related to a copy-paste which has not been updated
Should I leave |
We use entity in the common API in other places ( |
In hindsight, they should have kept entity. @jwage has mentioned this as a regret when creating ODM. The subtle naming difference has proved little more than a nuisance over the years. |
OK, Entity it is :-) On Friday, August 29, 2014, Jeremy Mikola notifications@github.com wrote:
|
Looks good to me know |
🆙 |
Strong -1 from me. |
@guilhermeblanco this class is not added in the Event system. It is added in the Persistence system, which is a consumer of the Event system. The goal here is to extract the common events to Doctrine Common Persistence too. |
So, what is the state of this ? It is just a standardization of event names used in every doctrine packages. It really helps external packages development as the event names are constants in the common package. If the event names are stored in the consumer, you need to : add every consumer as a dependency (just impossible), or test directly the strings (really not safe). |
Hello, |
Hi,
All doctrine projects implements events. A lot of them are similars, but there is no base class defining common Events.
I tried to gathen them all in this PR. I looked into
CouchDb-orm
,doctrine-orm
,doctrine-mongodb-odm
andphpcr-odm
.I only added events present in all packages, but CouchDB is the only one to not implement some events implemented in every other packages (
postPersist
,loadClassmetadata
,preFlush
, etc.).