Pimcore\Model\Document\Tag::getForWebserviceExport PHP 메소드

getForWebserviceExport() 공개 메소드

Returns the current tag's data for web service export
public getForWebserviceExport ( $document = null, mixed $params = [] ) : array
$params mixed
리턴 array
    public function getForWebserviceExport($document = null, $params = [])
    {
        $keys = get_object_vars($this);
        $el = [];
        foreach ($keys as $key => $value) {
            if ($value instanceof Model\Element\ElementInterface) {
                $value = $value->getId();
            }
            $className = Webservice\Data\Mapper::findWebserviceClass($value, "out");
            $el[$key] = Webservice\Data\Mapper::map($value, $className, "out");
        }
        unset($el["dao"]);
        unset($el["documentId"]);
        unset($el["controller"]);
        unset($el["view"]);
        unset($el["editmode"]);
        $el = Webservice\Data\Mapper::toObject($el);
        return $el;
    }

Usage Example

예제 #1
0
 /**
  * Returns the current tag's data for web service export
  *
  * @abstract
  * @return array
  */
 public function getForWebserviceExport()
 {
     $el = parent::getForWebserviceExport();
     if ($this->data["internal"]) {
         if (intval($this->data["internalId"]) > 0) {
             if ($this->data["internalType"] == "document") {
                 $referencedDocument = Document::getById($this->data["internalId"]);
                 if (!$referencedDocument instanceof Document) {
                     //detected broken link
                     $document = Document::getById($this->getDocumentId());
                 }
             } elseif ($this->data["internalType"] == "asset") {
                 $referencedAsset = Asset::getById($this->data["internalId"]);
                 if (!$referencedAsset instanceof Asset) {
                     //detected broken link
                     $document = Document::getById($this->getDocumentId());
                 }
             }
         }
     }
     $el->data = $this->data;
     return $el;
 }