findWebserviceClass() public static méthode

public static findWebserviceClass ( $object, $type ) : null | string
$object
$type
Résultat null | string
Exemple #1
0
 /**
  * @param $object
  * @param null $options
  * @throws \Exception
  */
 public function map($object, $options = null)
 {
     $keys = get_object_vars($this);
     $blockedKeys = array("childs");
     foreach ($keys as $key => $value) {
         $method = "get" . $key;
         if (method_exists($object, $method) && !in_array($key, $blockedKeys)) {
             if ($object->{$method}()) {
                 $this->{$key} = $object->{$method}();
                 // check for a pimcore data type
                 if ($this->{$key} instanceof Element\ElementInterface) {
                     $this->{$key} = $this->{$key}->getId();
                 }
                 // if the value is an object or array call the mapper again for the value
                 if (is_object($this->{$key}) || is_array($this->{$key})) {
                     $type = "out";
                     if (strpos(get_class($this), "_In") !== false) {
                         $type = "in";
                     }
                     $className = Webservice\Data\Mapper::findWebserviceClass($this->{$key}, "out");
                     $this->{$key} = Webservice\Data\Mapper::map($this->{$key}, $className, $type);
                 }
             }
         }
     }
 }
Exemple #2
0
 /**
  * @param $id
  * @throws \Exception
  */
 public function getAssetFolderById($id)
 {
     try {
         $asset = Asset::getById($id);
         if ($asset instanceof Asset\Folder) {
             $className = Webservice\Data\Mapper::findWebserviceClass($asset, "out");
             $apiAsset = Webservice\Data\Mapper::map($asset, $className, "out");
             return $apiAsset;
         }
         throw new \Exception("Asset Folder with given ID (" . $id . ") does not exist.");
     } catch (\Exception $e) {
         \Logger::error($e);
         throw $e;
     }
 }
Exemple #3
0
 /**
  * Returns the current tag's data for web service export
  * @param mixed $params
  * @abstract
  * @return 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;
 }