|
|
@@ -46,12 +46,26 @@ class Module
|
|
|
// return $cacheDriver->fetch('organization_modules_' . $organization->getId());
|
|
|
// }
|
|
|
|
|
|
+ // Get modules from the organization settings
|
|
|
$modulesBySettings = $this->getModuleBySettings($organization);
|
|
|
|
|
|
+ // Get modules according to the conditions defined in the config
|
|
|
$modulesByConditions = $this->getModulesByConditions($organization);
|
|
|
|
|
|
+ // Get the modules from the owned product
|
|
|
$product = $organization->getSettings()->getProduct();
|
|
|
$modulesForProduct = $this->getModulesByProductConfiguration($product);
|
|
|
+
|
|
|
+ // Controls that no modules where setup in different locations (this should not happen, and can lead to unexpected
|
|
|
+ // behaviors whend serializing the OrganizationProfile)
|
|
|
+ $intersection = array_merge(
|
|
|
+ array_intersect($modulesBySettings, $modulesByConditions),
|
|
|
+ array_intersect($modulesByConditions, $modulesForProduct),
|
|
|
+ array_intersect($modulesBySettings, $modulesForProduct)
|
|
|
+ );
|
|
|
+ if (!empty($intersection)) {
|
|
|
+ throw new \RuntimeException("Those modules are defined more than once : " . implode(', ', $intersection));
|
|
|
+ }
|
|
|
|
|
|
$organizationModules = array_merge_recursive($modulesForProduct, $modulesBySettings, $modulesByConditions);
|
|
|
|