當前位置: 首頁>>代碼示例>>PHP>>正文


PHP false::setObjectOutput方法代碼示例

本文整理匯總了PHP中false::setObjectOutput方法的典型用法代碼示例。如果您正苦於以下問題:PHP false::setObjectOutput方法的具體用法?PHP false::setObjectOutput怎麽用?PHP false::setObjectOutput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在false的用法示例。


在下文中一共展示了false::setObjectOutput方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fetch


//.........這裏部分代碼省略.........
         }
         // parse request url
         $this->method = $method;
         $this->urlSegment = explode('/', $url);
         $this->urlFragments = $params;
         $this->_inputXml = $inputXml;
         $this->depth = isset($this->urlFragments['depth']) ? (int) $this->urlFragments['depth'] : $this->depth;
         try {
             // Method below set a particular fonction to use on the price field for products entity
             // @see WebserviceRequest::getPriceForProduct() method
             // @see WebserviceOutputBuilder::setSpecificField() method
             //$this->objOutput->setSpecificField($this, 'getPriceForProduct', 'price', 'products');
             if (isset($this->urlFragments['price'])) {
                 $this->objOutput->setVirtualField($this, 'specificPriceForCombination', 'combinations', $this->urlFragments['price']);
                 $this->objOutput->setVirtualField($this, 'specificPriceForProduct', 'products', $this->urlFragments['price']);
             }
         } catch (Exception $e) {
             $this->setError(500, $e->getMessage(), $e->getCode());
         }
         if (isset($this->urlFragments['language'])) {
             $this->_available_languages = $this->filterLanguage();
         } else {
             $this->_available_languages = Language::getIDs();
         }
         if (empty($this->_available_languages)) {
             $this->setError(400, 'language is not available', 81);
         }
         // Need to set available languages for the render object.
         // Thus we can filter i18n field for the output
         // @see WebserviceOutputXML::renderField() method for example
         $this->objOutput->objectRender->setLanguages($this->_available_languages);
         // check method and resource
         if (empty($this->errors) && $this->checkResource() && $this->checkHTTPMethod()) {
             // The resource list is necessary for build the output
             $this->objOutput->setWsResources($this->resourceList);
             // if the resource is a core entity...
             if (!isset($this->resourceList[$this->urlSegment[0]]['specific_management']) || !$this->resourceList[$this->urlSegment[0]]['specific_management']) {
                 // load resource configuration
                 if ($this->urlSegment[0] != '') {
                     /** @var ObjectModel $object */
                     $object = new $this->resourceList[$this->urlSegment[0]]['class']();
                     if (isset($this->resourceList[$this->urlSegment[0]]['parameters_attribute'])) {
                         $this->resourceConfiguration = $object->getWebserviceParameters($this->resourceList[$this->urlSegment[0]]['parameters_attribute']);
                     } else {
                         $this->resourceConfiguration = $object->getWebserviceParameters();
                     }
                 }
                 $success = false;
                 // execute the action
                 switch ($this->method) {
                     case 'GET':
                     case 'HEAD':
                         if ($this->executeEntityGetAndHead()) {
                             $success = true;
                         }
                         break;
                     case 'POST':
                         if ($this->executeEntityPost()) {
                             $success = true;
                         }
                         break;
                     case 'PUT':
                         if ($this->executeEntityPut()) {
                             $success = true;
                         }
                         break;
                     case 'DELETE':
                         $this->executeEntityDelete();
                         break;
                 }
                 // Need to set an object for the WebserviceOutputBuilder object in any case
                 // because schema need to get webserviceParameters of this object
                 if (isset($object)) {
                     $this->objects['empty'] = $object;
                 }
             } else {
                 $specificObjectName = 'WebserviceSpecificManagement' . ucfirst(Tools::toCamelCase($this->urlSegment[0]));
                 if (!class_exists($specificObjectName)) {
                     $this->setError(501, sprintf('The specific management class is not implemented for the "%s" entity.', $this->urlSegment[0]), 124);
                 } else {
                     $this->objectSpecificManagement = new $specificObjectName();
                     $this->objectSpecificManagement->setObjectOutput($this->objOutput)->setWsObject($this);
                     try {
                         $this->objectSpecificManagement->manage();
                     } catch (WebserviceException $e) {
                         if ($e->getType() == WebserviceException::DID_YOU_MEAN) {
                             $this->setErrorDidYouMean($e->getStatus(), $e->getMessage(), $e->getWrongValue(), $e->getAvailableValues(), $e->getCode());
                         } elseif ($e->getType() == WebserviceException::SIMPLE) {
                             $this->setError($e->getStatus(), $e->getMessage(), $e->getCode());
                         }
                     }
                 }
             }
         }
     }
     $return = $this->returnOutput();
     unset($webservice_call);
     unset($display_errors);
     return $return;
 }
開發者ID:ekachandrasetiawan,項目名稱:BeltcareCom,代碼行數:101,代碼來源:WebserviceRequest.php


注:本文中的false::setObjectOutput方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。