Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.0ALPHA1
-
Fix Version/s: None
-
Component/s: Mapping Drivers
-
Labels:None
Description
In the manual, when configuring lifecycleCallbacks
lifecycleCallbacks:
doStuffOnPrePersist: prePersist
doStuffOnPostPersist: postPersist
it seems, that event name must be the key not the value
lifecycleCallbacks:
prePersist: doStuffOnPrePersist
postPersist: doStuffOnPostPersist
and when parsing it is expecting an array not a string
maybe a fix would be :
// Doctrine/ODM/MongoDB/Mapping/Driver/YamlDriver.php line 123 if (isset($element['lifecycleCallbacks'])) { foreach ($element['lifecycleCallbacks'] as $type => $methods) { if(!is_array($methods)){ $methods = array($methods); } foreach ($methods as $method) { $class->addLifecycleCallback($method, constant('Doctrine\ODM\MongoDB\ODMEvents::' . $type)); } } }
Hi, where in the documentation do you see that example?