lib/Core/Mapper/CollectionMapper.php
public function mapItem(PersistenceItem $item): Item
    {
        try {
            $itemDefinition = $this->itemDefinitionRegistry->getItemDefinition($item->valueType);
        } catch (ItemDefinitionException $e) {
            $itemDefinition = new NullItemDefinition($item->valueType);
        }

        $itemData = [
            'id' => $item->id,
            'status' => $item->status,
            'definition' => $itemDefinition,
            'collectionId' => $item->collectionId,
            'position' => $item->position,
            'value' => $item->value,
            'configs' => iterator_to_array(
                $this->configMapper->mapConfig(
                    $item->config,
                    $itemDefinition->getConfigDefinitions()
                )
            ),
            'cmsItem' => function () use ($item, $itemDefinition): CmsItemInterface {
                $valueType = $itemDefinition instanceof NullItemDefinition ? 'null' : $itemDefinition->getValueType();

                return $this->cmsItemLoader->load($item->value, $valueType);
            },
        ];

        return Item::fromArray($itemData);
    }
public function mapItem(PersistenceItem $item): Item
    {
        try {
            $itemDefinition = $this->itemDefinitionRegistry->getItemDefinition($item->valueType);
        } catch (ItemDefinitionException $e) {
            $itemDefinition = new NullItemDefinition($item->valueType);
        }

        $itemData = [
            'id' => $item->id,
            'status' => $item->status,
            'definition' => $itemDefinition,
            'collectionId' => $item->collectionId,
            'position' => $item->position,
            'value' => $item->value,
            'configs' => iterator_to_array(
                $this->configMapper->mapConfig(
                    $item->config,
                    $itemDefinition->getConfigDefinitions()
                )
            ),
            'cmsItem' => function () use ($item, $itemDefinition): CmsItemInterface {
                $valueType = $itemDefinition instanceof NullItemDefinition ? 'null' : $itemDefinition->getValueType();

                return $this->cmsItemLoader->load($item->value, $valueType);
            },
        ];

        return Item::fromArray($itemData);
    }
public function mapItem ( PersistenceItem $ item ) : Item { try { $ itemDefinition = $ this -> itemDefinitionRegistry -> getItemDefinition ( $ item -> valueType ) ; } catch ( ItemDefinitionException $ e ) { $ itemDefinition = new NullItemDefinition ( $ item -> valueType ) ; } $ itemData = [ 'id' => $ item -> id , 'status' => $ item -> status , 'definition' => $ itemDefinition , 'collectionId' => $ item -> collectionId , 'position' => $ item -> position , 'value' => $ item -> value , 'configs' => iterator_to_array ( $ this -> configMapper -> mapConfig ( $ item -> config , $ itemDefinition -> getConfigDefinitions ( ) ) ) , 'cmsItem' => function ( ) use ( $ item , $ itemDefinition ) : CmsItemInterface { $ valueType = $ itemDefinition instanceof NullItemDefinition ? 'null' : $ itemDefinition -> getValueType ( ) ; return $ this -> cmsItemLoader -> load ( $ item -> value , $ valueType ) ; } , ] ; return Item :: fromArray ( $ itemData ) ; }
Builds the API item value from persistence one.
Builds the API item value from persistence one .