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;
}