/**
* Structures are updated according to their xml definition.
*
* @param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise
*/
private function iterateStructures($addScheme)
{
$properties = [];
// find templates containing URL fields
$structureMetadatas = array_merge($this->structureMetadataFactory->getStructures('page'), $this->structureMetadataFactory->getStructures('snippet'));
$structureMetadatas = array_filter($structureMetadatas, function (StructureMetadata $structureMetadata) use(&$properties) {
$structureName = $structureMetadata->getName();
$this->findUrlProperties($structureMetadata, $properties);
return !empty($properties[$structureName]) || !empty($blockProperties[$structureName]);
});
foreach ($structureMetadatas as $structureMetadata) {
$this->iterateStructureNodes($structureMetadata, $properties[$structureMetadata->getName()], $addScheme);
}
$this->documentManager->flush();
}