@Assert\Callback

@param ExecutionContextInterface $context
170723
public function validate(ExecutionContextInterface $context)
    {
        if ($this->getOrigin() === $this->getTarget()) {
            $context->buildViolation('errors.redirect.origin_same_as_target')
                ->atPath('target')
                ->addViolation();
        }
    }
442874
private static function _checkCallback($cls, $callback, $context)
    {
        self::_initiateCallbacks($cls);
        foreach (self::$_callbacks[$cls][$callback] as $func) {
            if (!call_user_func(array($context, $func))) {
                return false;
            }
        }
        return true;
    }
645653
protected function doExecute(AssertionContext $context)
    {
        $id = Helper::generateID();
        $context->getAssertion()->setId($id);

        $this->logger->info(
            sprintf('Assertion ID set to "%s"', $id),
            LogHelper::getActionContext($context, $this, array('message_id' => $id))
        );
    }
969737
public function execute($callable, array $args = [], $context = null)
    {
        if ($callable instanceof \Closure) {
            $ref = new \ReflectionObject($callable);

            $args = $this->getMethodArgs($ref->getMethod('__invoke'), $args);
        } else {
            if (is_string($callable)) {
                $callable = explode('::', $callable);
            }

            list($object, $method) = $callable;

            $ref = new \ReflectionClass($object);

            $args = $this->getMethodArgs($ref->getMethod($method), $args);
        }

        $closure = function () use ($args, $callable) {
            switch (count($args)) {
                case 0:
                    return $callable();
                case 1:
                    return $callable($args[0]);
                case 2:
                    return $callable($args[0], $args[1]);
                case 3:
                    return $callable($args[0], $args[1], $args[2]);
                case 4:
                    return $callable($args[0], $args[1], $args[2], $args[3]);
                default:
                    return call_user_func_array($callable, $args);
            }
        };

        if ($context) {
            $closure = $closure->bindTo($context, $context);
        }

        return $closure();
    }
970880
public function initializeContext(Context $context)
    {
        if (!$context instanceof MinkAwareContext) {
            return;
        }

        $context->setMink($this->mink);
        $context->setMinkParameters($this->parameters);
    }
1199919
public void execute(JobExecutionContext context) throws JobExecutionException {

    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    OutputInvoker outputInvoker = (OutputInvoker)dataMap.get(OutputQuartzHelper.OUTPUT_JOB_NAME);

    if (outputInvoker != null) {
      // execute MP's output method
      outputInvoker.invokeOutput();
    } else {
      logger.warn("outputInvoker is NULL");
    }
  }
188511
public function activeFor(Context $context)
    {
        switch ($this->status) {
            case self::ALWAYS_ACTIVE:
                return true;
            case self::INACTIVE:
                return false;
            case self::CONDITIONALLY_ACTIVE:
                return $this->executeCondition($context);
        }
        return false;
    }
685878
public function validateEntity(ExecutionContextInterface $context)
    {
        if ($this->getType() == self::TYPE_PAGE_LINK && !$this->getNodeTranslation()) {
            $context->buildViolation('Please select a page')
              ->atPath('nodeTranslation')
              ->addViolation();
        } elseif ($this->getType() == self::TYPE_URL_LINK) {
            if (strlen($this->getTitle()) == 0) {
                $context->buildViolation('Please set the link title')
                  ->atPath('title')
                  ->addViolation();
            }
            if (strlen($this->getUrl()) == 0) {
                $context->buildViolation('Please set the link URL')
                  ->atPath('url')
                  ->addViolation();
            }
        }
    }
515269
public function execute($name, AnCommandContext $context)
    {
        $parts = explode('.', $name);

        if ($parts[0] == 'before') {
            $value = pick($this->{$this->getIdentifiableKey()}, $context->data->{$this->getIdentifiableKey()});

            if ($value) {
                $parent = $this->getParentRepository()->fetch($value);

                $this->setParent($parent);

                //set the entity owner as the context actor of the controller
                if ($parent && $this->getRepository()->isOwnable() && $this->isOwnable()) {
                    $this->setActor($parent->owner);
                }

                $context->data['parent'] = $parent;
            }
        }
    }
775390
public function checkExpirationDate(ExecutionContext $context)
    {
        $expirationDate = $this->expirationDate;

        if (is_null($expirationDate)) {
            $context->addViolationAt("expirationDate", "La fecha de vencimiento es invalida", array(), null);
        } else {
            $ts = $expirationDate->format('U');
            if ($ts<=time()) {
                $context->addViolationAt("expirationDate", "La fecha de vencimiento es invalida", array(), null);
            }
        }

    }
1040039
protected function doExecute(AssertionContext $context)
    {
        $context->getAssertion()->setIssueInstant($this->timeProvider->getTimestamp());

        $this->logger->info(
            sprintf('Assertion IssueInstant set to "%s"', $context->getAssertion()->getIssueInstantString()),
            LogHelper::getActionContext($context, $this)
        );
    }
695046
protected function _actionSend(DispatcherContext $context)
    {
        //Send the response
        $context->response->send(false);

        //Terminate the response
        $this->terminate($context);
    }
751706
public function isGroupCenterPresentOnce(ExecutionContextInterface $context)
    {
        $groupCentersIds = array();
        foreach ($this->getGroupCenters() as $groupCenter) {
            if (in_array($groupCenter->getId(), $groupCentersIds)) {
                $context->buildViolation("The user has already those permissions")
                        ->addViolation();
                
            } else {
                $groupCentersIds[] = $groupCenter->getId();
            }
        }
    }
604662
public function checkLink(ExecutionContextInterface $context)
    {
        $violation = false;
        // check if the name is actually a fake name
        switch ($this->getLinkType()) {
            case self::TYPE_VIEW_REFERENCE:
            $violation = $this->getViewReference() == null;
                break;
            case self::TYPE_ROUTE:
            $violation = $this->getRoute() == null;
                break;
            case self::TYPE_URL:
            $violation = $this->getUrl() == null;
                break;
            case self::TYPE_WIDGET:
            $violation = $this->getAttachedWidget() == null;
                break;
            default:
                break;
        }

        if ($violation) {
            $context->buildViolation('validator.link.error.message.'.$this->getLinkType().'Missing')->addViolation();
        }
    }
933478
protected function _afterSelect(DatabaseContext $context)
    {
        $rowset = $context->data;

        if($rowset instanceof DatabaseRowsetInterface)
        {
            $users = array();

            foreach($rowset as $row)
            {
                if(!empty($row->modified_by)) {
                    $users[] = $row->modified_by;
                }
            }

            //Lazy load the users
            $this->getObject('user.provider')->fetch($users, true);
        }
    }
405552
protected function _afterReset(ModelContextInterface $context)
    {
        $modified = (array) ObjectConfig::unbox($context->modified);
        if (in_array('limit', $modified))
        {
            $limit = $context->state->limit;

            if ($limit) {
                $context->state->offset = floor($context->state->offset / $limit) * $limit;
            }
        }
    }
462222
public function setStreamingContext($context, callable $callback)
    {
        if (0 === $context &= ~7) { // 0b00000111
            throw new InvalidArgumentException("Context must be a valid context value");
        }

        $this->setFlags($context);
        $this->streamCallback = $callback;
    }