Ejemplo n.º 1
0
 /**
  * @param string $callback
  * @param string $event
  */
 public function addLifecycleCallback($callback, $event)
 {
     if (!$this->reflClass->hasMethod($callback) || ($this->reflClass->getMethod($callback)->getModifiers() & \ReflectionMethod::IS_PUBLIC) == 0) {
         throw MappingException::lifecycleCallbackMethodNotFound($this->name, $callback);
     }
     return parent::addLifecycleCallback($callback, $event);
 }
 /**
  * Validate lifecycle callbacks
  *
  * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
  * @throws MappingException
  * @return void
  */
 public function validateLifecycleCallbacks($reflService)
 {
     foreach ($this->lifecycleCallbacks as $callbacks) {
         foreach ($callbacks as $callbackFuncName) {
             if (!$reflService->hasPublicMethod($this->name, $callbackFuncName)) {
                 throw MappingException::lifecycleCallbackMethodNotFound($this->name, $callbackFuncName);
             }
         }
     }
 }