setReturn example

$proxy->__pushHookExecutionContext($this->args->getMethod()$this);

        // Before hooks         $this->hookManager->getEventManager()->notify(
            $this->getHookEventName(Enlight_Hook_HookHandler::TypeBefore),
            $this->args
        );

        // Replace hooks and/or original method         $this->args->setProcessed(false);
        $returnValue = $this->executeReplaceChain($this->args->getArgs());
        $this->args->setReturn($returnValue);
        $this->args->setProcessed(true);

        // After hooks         $returnValue = $this->hookManager->getEventManager()->filter(
            $this->getHookEventName(Enlight_Hook_HookHandler::TypeAfter),
            $this->args->getReturn(),
            $this->args
        );

        // Remove this context from the proxy         $proxy->__popHookExecutionContext($this->args->getMethod());

        

    }

    public function onRegisterTemplate(Enlight_Event_EventArgs $args): void
    {
        $viewsDirectory = $this->pluginPath . '/Resources/views';

        $templates = (array) $args->getReturn();

        if (!\in_array($viewsDirectory$templates, true)) {
            $templates[] = $viewsDirectory;
            $args->setReturn($templates);
        }
    }

    public function onRegisterControllerTemplate(Enlight_Controller_ActionEventArgs $args): void
    {
        $viewsDirectory = $this->pluginPath . '/Resources/views';

        $controller = $args->getSubject();

        try {
            $view = $controller->View();
            
/** * Sets a value of an element in the list. * * @param string $key * @param mixed|null $value * * @return Shopware_Components_Cron_CronJob */
    public function set($key$value)
    {
        if ($key === 'data') {
            $this->setReturn($value);
        } else {
            $this->_elements[$key] = $value;
        }

        return $this;
    }

    /** * Returns a value of an element in the list. * * @param string $key * * @return mixed|null */
$action = str_replace(' ', '', ucwords(str_replace('_', ' ', $job->getAction())));
            $job->setAction('Shopware_CronJob_' . $action);
        }

        try {
            $this->adapter->startJob($job);
            /** @var Enlight_Components_Cron_EventArgs $jobArgs */
            $jobArgs = new $this->eventArgsClass([
                'subject' => $this,
                'job' => $job,
            ]);
            $jobArgs->setReturn($job->getData());

            $jobArgs = $this->eventManager->notifyUntil(
                $job->getAction(),
                $jobArgs
            );

            if ($jobArgs !== null) {
                $job->setData($jobArgs->getReturn());
                $this->adapter->updateJob($job);
            }

            

    public function notify($event$eventArgs = null)
    {
        if (!$this->hasListeners($event)) {
            return null;
        }

        $eventArgs = $this->buildEventArgs($eventArgs);
        $eventArgs->setReturn(null);
        $eventArgs->setName($event);
        $eventArgs->setProcessed(false);

        foreach ($this->getListeners($event) as $listener) {
            $listener->execute($eventArgs);
        }
        $eventArgs->setProcessed(true);

        return $eventArgs;
    }

    

    public function onClearCache(Enlight_Event_EventArgs $args)
    {
        $result = $this->clearCache();

        $args->setReturn($result);
    }

    /** * Callback for Shopware_Plugins_HttpCache_InvalidateCacheId-Event * * This events should be used to invalidate cacheIds without having * to check if the http-cache-plugin is installed and enabled. * * <code> * Shopware()->Events()->notify( * 'Shopware_Plugins_HttpCache_InvalidateCacheId', * array('cacheId' => 'a123') * ); * </code> * * @return void */
Home | Imprint | This part of the site doesn't use cookies.