/** * @param $object * @param null $options */ public function map($object, $options = null) { parent::map($object); $keys = get_object_vars($this); if (array_key_exists("childs", $keys)) { if ($object->hasChilds()) { $this->childs = array(); foreach ($object->getChilds() as $child) { $item = new Webservice\Data\Document\Listing\Item(); $item->id = $child->getId(); $item->type = $child->getType(); $this->childs[] = $item; } } } }
/** * @param $object * @param bool $disableMappingExceptions * @param null $idMapper * @throws \Exception */ public function reverseMap($object, $disableMappingExceptions = false, $idMapper = null) { parent::reverseMap($object, $disableMappingExceptions, $idMapper); $metadata = $this->metadata; if (is_array($metadata)) { $metadata = json_decode(json_encode($metadata), true); $object->metadata = $metadata; } }
/** * @param $class */ public function map($class, $options = null) { $arr = $class->fieldDefinitions; $result = []; foreach ($arr as $item) { $result[] = $item; } $class->fieldDefinitions = $item; parent::map($class); }