mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Allow private/protected lifecycle callbacks #5393
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 @Stelian on GitHub (Jan 25, 2017).
Currently, if a callback method is being defined as private or protected, it is just ignored and not executed:
Ideally we could declare the methods as being private because we mostly want to use the callbacks to not expose the behavior to the callee.
If this is not feasible, an exception should be thrown informing the callee that private/protected are not supported.
@Ocramius commented on GitHub (Jan 25, 2017):
The code to be changed is quite trivial, but I don't know how much of it was already changed by @guilhermeblanco for 3.x (
developbranch).See
888f1be7c9/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php (L503-L528)meanwhile.We can rely on
$reflectionMethod->getClosure()to make this work...