Occurs on rest.controller.classcontentcontroller.getAction.postcall events.

@param Event $event
434288
public static function onPostCall(Event $event)
    {
        $response = $event->getResponse();
        if ($response->headers->get('content-type') === 'text/html') {
            return;
        }

        $application = $event->getApplication();
        $renderer = $application->getRenderer();
        $content = json_decode($response->getContent());

        $result = false;
        if ($content instanceof \StdClass) {
            if (isset($content->type) && isset($content->parameters)) {
                if (isset($content->parameters->rendermode)) {
                    $result = true;
                }
            }
        }

        if (!$result) {
            return;
        }

        $rendermodeParam = $content->parameters->rendermode;
        $classname =  AbstractClassContent::getClassnameByContentType($content->type);

        $modes = ['default' => 'Default mode'];
        foreach ($renderer->getAvailableRenderMode(new $classname()) as $mode) {
            $modes[$mode] = ucfirst(str_replace('_', ' ', $mode));
        }

        $rendermodeParam->options = $modes;

        $response->setContent(json_encode($content));
    }
785891
public function onRequestBeforeSend(Event $event)
    {
        $request = $event['request'];

        $request->setHeader('Accept',(string) $this->config['accept-header']);

        return $this->config['accept-header'];
    }
528259
public function onSuccess(PostCallEvent $event)
    {
        if ($this->level >= self::LEVEL_ALL_REQUEST) {
            $this->dump($event);
        }
    }
667180
public function onPostDeserialize(ObjectEvent $event)
    {
        /** @var TargetGroupRuleInterface $targetGroupRule */
        $targetGroupRule = $event->getObject();

        if (!$targetGroupRule instanceof TargetGroupRuleInterface) {
            return;
        }

        if ($targetGroupRule->getConditions()) {
            foreach ($targetGroupRule->getConditions() as $condition) {
                $condition->setRule($targetGroupRule);
            }
        }
    }
52755
private function captureHookStatsOnEvent(Event $event)
    {
        if ($event instanceof AfterSetup && $event->getSetup() instanceof HookedSetup) {
            $this->captureBeforeHookStats($event->getSetup());
        }

        if ($event instanceof AfterTested && $event->getTeardown() instanceof HookedTeardown) {
            $this->captureAfterHookStats($event->getTeardown());
        }
    }
922591
public function beforeFilter(Event $event)
    {
        $slug = lcfirst($this->request->params['type']);

        $this->type = $this->PostTypes->getOption($slug);

        if (!$this->type) {
            throw new Exception("The PostType is not registered");
        }

        $this->Model = TableRegistry::get($this->type['model']);

        // making the current item active
        $this->Menu->active($this->type['alias']);

        parent::beforeFilter($event);
    }
407805
private function captureStepStatsOnAfterEvent(Event $event)
    {
        if (!$event instanceof AfterStepTested) {
            return;
        }

        $result = $event->getTestResult();
        $step = $event->getStep();
        $text = sprintf('%s %s', $step->getKeyword(), $step->getText());
        $exception = $this->getStepException($result);

        $path = $this->getStepPath($event, $exception);
        $error = $exception ? $this->exceptionPresenter->presentException($exception) : null;
        $stdOut = $result instanceof ExecutedStepResult ? $result->getCallResult()->getStdOut() : null;

        $resultCode = $result->getResultCode();
        $stat = new StepStatV2($this->scenarioTitle, $this->scenarioPath, $text, $path, $resultCode, $error, $stdOut);

        $this->statistics->registerStepStat($stat);
    }
895925
public function onRequestSent(Event $event)
    {
        $request = $event['request'];
        $response = $event['response'];
        $handle = $event['handle'];

        if ($wire = $request->getParams()->get('request_wire')) {
            $request = clone $request;
            $request->setBody($wire);
        }

        if ($wire = $request->getParams()->get('response_wire')) {
            $response = clone $response;
            $response->setBody($wire);
        }

        // Send the log message to the adapter, adding a category and host
        $priority = $response && $response->isError() ? LOG_ERR : LOG_DEBUG;
        $message = $this->formatter->format($request, $response, $handle);
        $this->logAdapter->log($message, $priority, array(
            'request'  => $request,
            'response' => $response,
            'handle'   => $handle
        ));
    }
555403
public function cleanupRequest(Event $event)
    {
        $params = $event['request']->getParams();
        unset($params[self::REDIRECT_COUNT]);
        unset($params[self::PARENT_REQUEST]);
    }
1317706
public function afterFilter(Event $event)
    {
        $pluginEvent = Plugin::getData('Core', 'Controller.afterFilter');
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.afterFilter')) {
            call_user_func_array($pluginEvent->find(0), [$this, $event]);
        }
    }
1361743
public static function onFlushContent(Event $event)
    {
        if (null === self::getEntityManager($event)) {
            return;
        }

        $contents_inserted = ScheduledEntities::getScheduledAClassContentInsertions(self::$em, true, true);
        $contents_updated = ScheduledEntities::getScheduledAClassContentUpdates(self::$em, true, true);
        $contents_deleted = ScheduledEntities::getSchedulesAClassContentDeletions(self::$em, true);

        // Updates content-content indexes
        self::updateIdxContentContents(array_merge($contents_inserted, $contents_updated), $contents_deleted);

        // Updates site-content indexes
        self::updateIdxSiteContents($contents_inserted, $contents_deleted);

        $content = $event->getTarget();
        if (!($content instanceof AbstractClassContent)) {
            return;
        }
        $dispatcher = $event->getDispatcher();
        $application = $dispatcher->getApplication();
        if (null === $application) {
            return;
        }

        $uow = self::$em->getUnitOfWork();

        if ($uow->isScheduledForInsert($content) || $uow->isScheduledForUpdate($content)) {
            self::$em->getRepository('BackBee\ClassContent\Indexes\OptContentByModified')
                    ->replaceOptContentTable($content);

            self::indexContent($content);
            self::updateSuperContentIndexes($content);
        } elseif ($uow->isScheduledForDelete($content)) {
            self::$em
                ->getRepository('BackBee\ClassContent\Indexes\OptContentByModified')
                ->removeOptContentTable($content)
            ;

            foreach ($content->getIndexation() as $index) {
                self::$em->remove($index);
                self::$em
                    ->getUnitOfWork()
                    ->computeChangeSet(self::$em->getClassMetadata('BackBee\ClassContent\Indexation'), $index)
                ;
            }
        }
    }
804075
protected function handle(Event $event)
    {
        $method = $this->getApplyMethod($event);
        if (!method_exists($this, $method)) {
            return;
        }
        $this->$method($event);
    }
1159073
public static function onInclude(Event $event)
    {
        $dispatcher = $event->getDispatcher();
        if (null !== $dispatcher->getApplication()) {
            if (null === $em = $dispatcher->getApplication()->getEntityManager()) {
                return;
            }

            $shortClassname = AbstractClassContent::getShortClassname($event->getTarget());
            $fullClassname = AbstractClassContent::getFullClassname($event->getTarget());
            foreach (class_parents($fullClassname) as $classname) {
                $em->getClassMetadata($classname)->addDiscriminatorMapClass($shortClassname, $fullClassname);

                if ('BackBee\ClassContent\AbstractClassContent' === $classname) {
                    break;
                }
            }
        }
    }
31123
public function onRequestException(Event $event)
    {
        if (!$event['exception'] instanceof CurlException) {
            return;
        }

        $request = $event['request'];
        if (!$this->canCache->canCacheRequest($request)) {
            return;
        }

        if ($response = $this->storage->fetch($request)) {
            $response->setHeader('Age', time() - strtotime($response->getDate() ? : 'now'));
            if (!$this->canResponseSatisfyFailedRequest($request, $response)) {
                return;
            }
            $request->getParams()->set('cache.hit', 'error');
            $request->setResponse($response);
            $this->addResponseHeaders($request, $response);
            $event->stopPropagation();
        }
    }
1015020
public function onRequestSent(Event $event)
    {
        $request = $event['request'];
        $response = $event['response'];
        $exception = $event['exception'];

        $params = $request->getParams();
        $retries = (int) $params->get(self::RETRY_PARAM);
        $delay = $this->strategy->getBackoffPeriod($retries, $request, $response, $exception);

        if ($delay !== false) {
            // Calculate how long to wait until the request should be retried
            $params->set(self::RETRY_PARAM, ++$retries)
                ->set(self::DELAY_PARAM, microtime(true) + $delay);
            // Send the request again
            $request->setState(RequestInterface::STATE_TRANSFER);
            $this->dispatch(self::RETRY_EVENT, array(
                'request'  => $request,
                'response' => $response,
                'handle'   => $exception ? $exception->getCurlHandle() : null,
                'retries'  => $retries,
                'delay'    => $delay
            ));
        }
    }
1350675
public function onKernelRequest(GetResponseEvent $event): void
    {
        $request = $event->getRequest();
        $method = $request->getMethod();

        if (
            'DELETE' === $method
            || $request->isMethodSafe(false)
            || !($attributes = RequestAttributesExtractor::extractAttributes($request))
            || !$attributes['receive']
            || (
                    '' === ($requestContent = $request->getContent())
                    && ('POST' === $method || 'PUT' === $method)
               )
        ) {
            return;
        }

        $context = $this->serializerContextBuilder->createFromRequest($request, false, $attributes);
        if (isset($context['input']) && \array_key_exists('class', $context['input']) && null === $context['input']['class']) {
            return;
        }

        // BC check to be removed in 3.0
        if (null !== $this->formatsProvider) {
            $this->formats = $this->formatsProvider->getFormatsFromAttributes($attributes);
        }
        $this->formatMatcher = new FormatMatcher($this->formats);
        $format = $this->getFormat($request);

        $data = $request->attributes->get('data');
        if (null !== $data) {
            $context[AbstractNormalizer::OBJECT_TO_POPULATE] = $data;
        }

        $request->attributes->set(
            'data',
            $this->serializer->deserialize(
                $requestContent, $context['resource_class'], $format, $context
            )
        );
    }
146960
protected function handleEvent($event)
    {
        if (!is_null($response = $this->call('event.*', array($event)))) {
            return $response;
        }

        $event['Event'] = strtolower($event['Event']);

        return $this->call("event.{$event['Event']}", array($event));
    }