eZ\Publish\Core\FieldType\Page\HashConverter::convertItemToHash PHP Method

convertItemToHash() protected method

Converts the given $item into a plain hash format.
protected convertItemToHash ( Item $item ) : array
$item eZ\Publish\Core\FieldType\Page\Parts\Item
return array
    protected function convertItemToHash(Item $item)
    {
        $hash = array();
        foreach ($item->getState() as $propName => $propValue) {
            switch ($propName) {
                case 'blockId':
                case 'contentId':
                case 'locationId':
                case 'priority':
                case 'movedTo':
                case 'action':
                    if ($propValue !== null) {
                        $hash[$propName] = $propValue;
                    }
                    break;
                case 'attributes':
                    if ($propValue !== null && $propValue !== array()) {
                        $hash['attributes'] = $propValue;
                    }
                    break;
                case 'publicationDate':
                case 'visibilityDate':
                case 'hiddenDate':
                case 'rotationUntilDate':
                    if ($propValue !== null) {
                        /* @var $propValue \DateTime */
                        $hash[$propName] = $propValue->format(\DateTime::RFC850);
                    }
                    break;
            }
        }
        return $hash;
    }