예제 #1
0
 /**
  * @param Context $context
  * @param array   $groups
  */
 private function changeContextGroups(Context $context, array $groups)
 {
     if ($context->attributes->containsKey('groups')) {
         $context->attributes->set('groups', $groups);
     }
     $exclusionStrategy = $context->getExclusionStrategy();
     if ($exclusionStrategy instanceof DisjunctExclusionStrategy) {
         foreach ($exclusionStrategy->getStrategies() as $delegate) {
             if ($delegate instanceof GroupsExclusionStrategy) {
                 $delegate->setGroups($groups);
             }
         }
         return;
     }
     if ($exclusionStrategy instanceof GroupsExclusionStrategy) {
         $exclusionStrategy->setGroups($groups);
     }
 }