Pimcore\Model\Document\Tag\Image::getFromWebserviceImport PHP Метод

getFromWebserviceImport() публичный Метод

public getFromWebserviceImport ( Pimcore\Model\Webservice\Data\Document\Element $wsElement, $document = null, mixed $params = [], null $idMapper = null )
$wsElement Pimcore\Model\Webservice\Data\Document\Element
$params mixed
$idMapper null
    public function getFromWebserviceImport($wsElement, $document = null, $params = [], $idMapper = null)
    {
        $data = $wsElement->value;
        if ($data->id !== null) {
            $this->alt = $data->alt;
            $this->id = $data->id;
            if ($idMapper) {
                $this->id = $idMapper->getMappedId("asset", $data->id);
            }
            if (is_numeric($this->id)) {
                $image = $this->getImage();
                if (!$image instanceof Asset\Image) {
                    if ($idMapper && $idMapper->ignoreMappingFailures()) {
                        $idMapper->recordMappingFailure("document", $this->getDocumentId(), "asset", $data->id);
                    } else {
                        throw new \Exception("cannot get values from web service import - referenced image with id [ " . $this->id . " ] is unknown");
                    }
                }
            } else {
                if ($idMapper && $idMapper->ignoreMappingFailures()) {
                    $idMapper->recordMappingFailure("document", $this->getDocumentId(), "asset", $data->id);
                } else {
                    throw new \Exception("cannot get values from web service import - id is not valid");
                }
            }
        }
    }