当前位置: 首页>>代码示例>>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;未经允许,请勿转载。