Execute method.

@return null
6377
public function execute()
    {
        $addressBookName = $this->getRequest()->getParam('name');
        $visibility = $this->getRequest()->getParam('visibility');
        $website = (int) $this->getRequest()->getParam('website', 0);

        if ($this->helperData->isEnabled($website)) {
            $client = $this->helperData->getWebsiteApiClient($website);
            if (! empty($addressBookName)) {
                $response = $client->postAddressBooks($addressBookName, $visibility);
                if (isset($response->message)) {
                    $this->messageManager->addErrorMessage($response->message);
                } else {
                    $this->messageManager->addSuccessMessage('Address book successfully created.');
                }
            }
        }
    }
1214574
public function execute()
    {
        $methods = array_values($this->implementedEvents());
        foreach ($methods as $method) {
            $this->dispatchEvent(sprintf('Bake.%s', $method), null, $this->event->subject);
        }
    }
986647
public function execute()
    {
        $this->client->setResource($this->order->getResource());

        return $this->client->post('/{order_id}/payments', [$this->order->id], $this->data)->getResults();
    }
996166
public function execute()
    {
        if (!$this->isEmpty()) {
            $this->table->delete($this->context + $this->where)->run();
        }

        parent::execute();
    }
824131
public function exec()
    {
        $this->setup();

        // get the annotation metadata for this resource
        $resourceMetadata = $this->app->getResourceMetadata($this);

        $methodPriorities = $this->calculateMethodPriorities($resourceMetadata);

        $methodName = null;
        $bestMatch = -2;
        foreach ($methodPriorities as $name => $priority) {
            if ($priority['value'] > $bestMatch) {
                $bestMatch = $priority['value'];
                $methodName = $name;
            }
        }

        if (!$methodName) {
            throw new Exception('No method matches request method');

        } elseif (isset($methodPriorities[$methodName]['response'])) {
            $response = Response::create($methodPriorities[$methodName]['response']);

        } elseif (isset($methodPriorities[$methodName]['exception'])) {
            throw $methodPriorities[$methodName]['exception'];

        } else {
            foreach (array('*', $methodName) as $mn) {
                if (isset($this->before[$mn])) {
                    foreach ($this->before[$mn] as $action) {
                        call_user_func($action, $this->request, $mn);
                    }
                }
            }
            $response = Response::create(call_user_func_array(array($this, $methodName), $this->params));
            foreach (array('*', $methodName) as $mn) {
                if (isset($this->after[$mn])) {
                    foreach ($this->after[$mn] as $action) {
                        call_user_func($action, $response, $mn);
                    }
                }
            }
        }

        return $response;
    }
1167568
public function execute()
    {
        $params = $this->getRequest()->getParams();
        $apiUsername = $params['api_username'];
        $apiPassword = base64_decode($params['api_password']);
        //validate api, check against account info.
        if ($this->data->isEnabled()) {
            $client = $this->data->getWebsiteApiClient();
            $result = $client->validate($apiUsername, $apiPassword);

            $resonseData['success'] = true;
            //validation failed
            if (!$result) {
                $resonseData['success'] = false;
                $resonseData['message'] = 'Authorization has been denied for this request.';
            }

            $this->getResponse()->representJson($this->jsonHelper->jsonEncode($resonseData));
        }
    }
108605
public function execute()
    {
        $db = $this->db;

        $qp = array();

        if (isset($this->q['query'])) {
            $sth = $db->prepare($this->q['query']);
        } else {
            $qp = $this->makeQuery();
            $sth = $db->prepare($qp['query']);
            foreach ($qp['params'] as $key => $val) {
                if (is_int($val)) {
                    $sth->bindValue("$key", $val, $db::PARAM_INT);
                } else {
                    $sth->bindValue("$key", $val);
                }
            }
        }

        $sth->execute();

        return $sth;
    }
110264
public function execute()
    {
        foreach ($this->getJobs() as $key => $job) {
            try {
                $this->console($job, $key + 1);
                $task = $this->createTask($job);
                $return = $task->run();
                $this->getAdapter()->history(HistoryInterface::STATUS_OK, $job, is_string($return) ? $return : null);
            } catch (\Exception $exc) {
                $this->log($job, $exc);
            }
        }

        $this->getAdapter()->finishProcessing($this->getJobs());
    }
1257998
public function executeCommands()
    {
        $commands = $this->getCommands();
        foreach ($commands as $command) {
            call_user_func_array([$this->getAdapter(), $command['name']], $command['arguments']);
        }
    }
184262
public function execute()
    {
        if (method_exists($this, 'setUp')) {
            call_user_func_array([$this, 'setUp'], [$this->request]);
        }
        call_user_func_array([$this, $this->action], [$this->request]);
    }
297495
public function execute()
    {
        // Get the parameters
        $params = $this->getParams();

        // Get the url
        $url = $this->getUrl($params);

        // Run it
        return $this->sendRequest($url, $params);
    }
558325
public function execute($method=null) {
    $isDebugEnabled = $this->logger->isDebugEnabled();
    if ($isDebugEnabled) {
      $this->logger->debug('Executing: '.get_class($this).($method ? '::'.$method: ''));
      $this->logger->debug('Request: '.$this->request);
    }

    // validate controller data
    $validationFailed = false;
    if (!$this->validate()) {
      $validationFailed = true;
    }

    // execute controller logic
    if (!$validationFailed) {
      try {
        $this->doExecute($method);
        $this->endTransaction(true);
      }
      catch (\Exception $ex) {
        if ($ex instanceof ApplicationException) {
          $error = $ex->getError();
          $this->response->addError($error);
          $this->response->setStatus($error->getStatusCode());
        }
        else {
          $this->getLogger()->error($ex);
          $error = ApplicationError::fromException($ex);
          $this->response->addError($error);
          $this->response->setStatus($error->getStatusCode());
        }
        $this->endTransaction(false);
      }
    }

    // return the last error
    $errors = array_merge($this->request->getErrors(), $this->response->getErrors());
    if (sizeof($errors) > 0) {
      $error = array_pop($errors);
      $this->response->setValue('errorCode', $error->getCode());
      $this->response->setValue('errorMessage', $error->getMessage());
      $this->response->setValue('errorData', $error->getData());
      $this->response->setStatus($error->getStatusCode());
    }

    // log errors
    for ($i=0,$count=sizeof($errors); $i<$count; $i++) {
      $error = $errors[$i];
      $message = $error->__toString();
      switch ($error->getLevel()) {
        case ApplicationError::LEVEL_WARNING:
          $this->logger->warn($message);
          break;
        default:
          $this->logger->error($message);
      }
    }

    if ($isDebugEnabled) {
      $this->logger->debug('Response: '.$this->response);
    }
  }
878923
public function execute()
    {
        try {
            if ($action = $this->action) {
                return $action($this);
            } else {
                foreach ($this->parseSteps as $parseStep) {
                    if (is_string($parseStep)) {
                        $parseStep = [$this->controller, $parseStep];
                    }

                    if ($parseStep($this) === false) {
                        return false;
                    }
                }

                $queryStep = $this->queryStep;
                if (is_string($queryStep)) {
                    $queryStep = [$this->controller, $queryStep];
                }

                $result = $queryStep($this);

                foreach ($this->transformSteps as $transformStep) {
                    if (is_string($transformStep)) {
                        $transformStep = [$this->controller, $transformStep];
                    }

                    if ($transformStep($result, $this) === false) {
                        return false;
                    }
                }
            }
        // handle API exceptions
        } catch (Error\Base $ex) {
            if (method_exists($this->controller, 'handleError')) {
                $this->controller->handleError($ex, $this);
            }
        }

        return true;
    }
651532
public function execute()
    {
        $out = '';

        $topic = isset($this->getParseResult()->command->args['topic'])
               ? $this->getParseResult()->command->args['topic'] : null;
        if (null === $topic) {
            $out = $this->getUsageHelp();
        } else {
            $out = $this->getTopicHelp($topic);
        }

        $this->out($this->getHeader());
        $this->out($out);
        $this->out($this->getFooter());
    }
99013
public function execute()
    {
        /** @var \Limesharp\Stockists\Api\Data\StockistInterface $stockist */
        $stockist = null;
        $data = $this->getRequest()->getPostValue();
        $id = !empty($data['stockist_id']) ? $data['stockist_id'] : null;
        $resultRedirect = $this->resultRedirectFactory->create();


        try {
            if ($id) {
                $stockist = $this->stockistRepository->getById((int)$id);
            } else {
                unset($data['stockist_id']);
                $stockist = $this->stockistFactory->create();
            }
            $image = $this->getUploader('image')->uploadFileAndGetName('image', $data);
            $data['image'] = $image;
            $details_image = $this->getUploader('image')->uploadFileAndGetName('details_image', $data);
            $data['details_image'] = $details_image;

            if(!empty($data['store_id']) && is_array($data['store_id'])) {
                if(in_array('0',$data['store_id'])){
                    $data['store_id'] = '0';
                }
                else{
                    $data['store_id'] = implode(",", $data['store_id']);
                }
            }
            $storeId = $data["store_id"] ?? $this->storeManager->getStore()->getId();

            $this->dataObjectHelper->populateWithArray($stockist, $data, StockistInterface::class);
            $this->stockistRepository->save($stockist);

            if($data["link"]) {
                $this->saveUrlRewrite($data["link"], $stockist->getId(), $storeId);
            }

            $this->messageManager->addSuccessMessage(__('You saved the store'));
            if ($this->getRequest()->getParam('back')) {
                $resultRedirect->setPath('stockists/stores/edit', ['stockist_id' => $stockist->getId()]);
            } else {
                $resultRedirect->setPath('stockists/stores');
            }
        } catch (LocalizedException $e) {
            $this->messageManager->addErrorMessage($e->getMessage());
            if ($stockist != null) {
                $this->storeStockistDataToSession(
                    $this->dataObjectProcessor->buildOutputDataArray(
                        $stockist,
                        StockistInterface::class
                    )
                );
            }
            $resultRedirect->setPath('stockists/stores/edit', ['stockist_id' => $id]);
        } catch (\Exception $e) {
            $this->messageManager->addErrorMessage(__('There was a problem saving the store'));
            if ($stockist != null) {
                $this->storeStockistDataToSession(
                    $this->dataObjectProcessor->buildOutputDataArray(
                        $stockist,
                        StockistInterface::class
                    )
                );
            }
            $resultRedirect->setPath('stockists/stores/edit', ['store_id' => $id]);
        }
        return $resultRedirect;
    }
600982
public function execute()
    {
        foreach (array_unique($this->bootstrappers->all()) as $class) {
            $bootstrapper = $this->create($class);

            if (!method_exists($bootstrapper, 'run')) {
                throw new \RuntimeException("$class must have run() method");
            }

            $bootstrapper->run();
        }
    }
1294593
protected function execute_query()
    {
        $query = $this->database->getQueryCollection()->findQuery($this->strQuery);

        if ($query) {
            return $query->result();
        }

        return null;
    }