Пример #1
0
 function intercept(MethodInvocation $invocation)
 {
     $args = $invocation->getArguments();
     foreach ($invocation->getMethod()->getParameters() as $i => $parameter) {
         if ($parameter->isAnnotatedWith("Spot\\Domain\\Validate")) {
             $validate = $parameter->getAnnotation("Spot\\Domain\\Validate");
             $this->validator->validate($args[$i], $validate->groups);
         }
     }
     return $invocation->proceed();
 }
Пример #2
0
 function intercept(MethodInvocation $invocation)
 {
     $args = $invocation->getArguments();
     foreach ($invocation->getMethod()->getParameters() as $i => $parameter) {
         if ($parameter->isAnnotatedWith("Spot\\Domain\\Persist")) {
             $this->domain->persist($args[$i]);
         } else {
             if ($parameter->isAnnotatedWith("Spot\\Domain\\Remove")) {
                 $this->domain->remove($args[$i]);
             }
         }
     }
     return $invocation->proceed();
 }