/** * Check whether all themes have correct parent theme by type * * @return $this */ public function checkAllowedThemeRelations() { foreach ($this->_forbiddenRelations as $typesSequence) { list($parentType, $childType) = $typesSequence; $collection = $this->_collectionFactory->create(); $collection->addTypeRelationFilter($parentType, $childType); /** @var $theme ThemeInterface */ foreach ($collection as $theme) { $parentId = $this->_getResetParentId($theme); if ($theme->getParentId() != $parentId) { $theme->setParentId($parentId)->save(); } } } return $this; }