protected function convertZoneToHash(Zone $zone)
{
$hash = array();
foreach ($zone->getState() as $propName => $propValue) {
switch ($propName) {
case 'id':
case 'identifier':
case 'action':
if ($propValue !== null) {
$hash[$propName] = $propValue;
}
break;
case 'attributes':
if ($propValue !== null && $propValue !== array()) {
$hash['attributes'] = $propValue;
}
break;
case 'blocks':
foreach ($propValue as $block) {
$hash['blocks'][] = $this->convertBlockToHash($block);
}
break;
}
}
return $hash;
}