protected function buildChildrenSelects(LocationData $selectedRootLocation, array $hierarchy)
{
$childrenLocations = $this->locationProvider->getChildren($selectedRootLocation->getId());
do {
$selectedRootLocation = array_shift($hierarchy);
$locationExample = reset($childrenLocations);
$options = $this->generateOptions($childrenLocations);
if ($selectedRootLocation) {
$selected = $selectedRootLocation->getId();
$childrenLocations = $this->maxLocationType !== $locationExample->getType() ? $childrenLocations = $this->locationProvider->getChildren($selectedRootLocation->getId()) : null;
} else {
$selected = null;
$childrenLocations = null;
}
$this->selects[] = $this->formatSelector($locationExample->getType(), $options, $selected);
} while ($childrenLocations);
}