/** * {@inheritdoc} */ public function handle(MassActionHandlerArgs $args) { $massAction = $args->getMassAction(); $entityName = $this->actionRepository->getEntityName($args->getDatagrid()); if (!$this->isMassActionEnabled($entityName)) { return $this->getResponse($massAction, 0, 'Action not configured or not allowed'); } $massAction->getOptions()->offsetSet('entityName', $entityName); $entitiesCount = $this->actionRepository->batchUpdate($massAction, $args->getResults(), $args->getData()); return $this->getResponse($massAction, $entitiesCount); }
public function handle(MassActionHandlerArgs $args) { $iterations = 0; $entities = $args->getData(); $entities = explode(',', $entities['values']); try { foreach ($entities as $user) { $this->userService->resetPassword(new User($user, User::TYPE_DIAMANTE)); ++$iterations; } } catch (\Exception $e) { throw $e; } return $this->getResponse($args, $iterations); }
/** * {@inheritDoc} */ public function handle(MassActionHandlerArgs $args) { $data = $args->getData(); $massAction = $args->getMassAction(); $options = $massAction->getOptions()->toArray(); $this->entityManager->beginTransaction(); try { set_time_limit(0); $iteration = $this->handleHeadEmails($options, $data); $this->handleThreadEmails($options); $this->entityManager->commit(); } catch (\Exception $e) { $this->entityManager->rollback(); throw $e; } return $this->getResponse($args, $iteration); }
/** * @param MassActionHandlerArgs $args */ public function __construct(MassActionHandlerArgs $args) { $this->args = $args->getData(); }