Skip to content
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

DDC-73: Lifecycle Events only work with undocumented @HasLifecycleCallbacks in Annonation classes #5242

Closed
doctrinebot opened this issue Oct 29, 2009 · 7 comments
Labels
Milestone

Comments

@doctrinebot
Copy link

Jira issue originally created by user nicokaiser:

When using Docblock Annotations, Lifecycle Events don't work as described here:
http://www.doctrine-project.org/documentation/manual/2_0/en/events

Functions with e.g. "@PrePersist" annonations are not called unless the class(!) has "@HasLifecycleCallbacks" annotation in its class header docblock.

This behavior should be either documented or changed (no need for the @HasLifecycleCallbacks annotation)

@doctrinebot
Copy link
Author

Comment created by lucasts:

Working patch to trunk(r6683)

WIth this patch the foreach ran every time, but as metadata are cached, I guess that will not be a problem.

@doctrinebot
Copy link
Author

Comment created by romanb:

This should rather be fixed in the documentation instead. I think @HasLifecycleCallbacks is useful not only to save some overhead but also as a visual clue to quickly see whether a class has lifecycle callbacks without looking at all methods.

@doctrinebot
Copy link
Author

Comment created by @guilhermeblanco:

I think the opposite.

Overhead will only exist during metadata creation.
It's then irrelevant since we strongly suggest a cache mechanism at the top of metadata information.

I'm +1 to commit suggested patch.

@doctrinebot
Copy link
Author

Comment created by romanb:

Its far from irrelevant. Everything should be as fast as possible and during development you usually dont use APC/memcache as metadata cache because you would have to clear it manually after every change. Its simply not worth this absolutely minor convenience that we iterate over *all* methods of all entity classes just to look for lifecycle callbacks.

Again, this needs to be fixed in the documentation.

@doctrinebot
Copy link
Author

Comment created by romanb:

And to make it even clearer: Not even a metadata cache is the ultimate thing for performance since the unserialization is not very fast either. So please dont ever think something is irrelevant. This is php and php is pretty slow.

@doctrinebot
Copy link
Author

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-ALPHA3 milestone Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
@doctrinebot
Copy link
Author

Imported 1 attachments from Jira into https://gist.github.com/359f27d0bca83a98357d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant