private function getMountsFromQuery(IQueryBuilder $query)
 {
     $result = $query->execute();
     $mounts = $result->fetchAll();
     $mountIds = array_map(function ($mount) {
         return $mount['mount_id'];
     }, $mounts);
     $applicable = $this->getApplicableForMounts($mountIds);
     $config = $this->getConfigForMounts($mountIds);
     $options = $this->getOptionsForMounts($mountIds);
     return array_map(function ($mount, $applicable, $config, $options) {
         $mount['type'] = (int) $mount['type'];
         $mount['priority'] = (int) $mount['priority'];
         $mount['applicable'] = $applicable;
         $mount['config'] = $config;
         $mount['options'] = $options;
         return $mount;
     }, $mounts, $applicable, $config, $options);
 }
 private function getMountsFromQuery(IQueryBuilder $query)
 {
     $result = $query->execute();
     $mounts = $result->fetchAll();
     $uniqueMounts = [];
     foreach ($mounts as $mount) {
         $id = $mount['mount_id'];
         if (!isset($uniqueMounts[$id])) {
             $uniqueMounts[$id] = $mount;
         }
     }
     $uniqueMounts = array_values($uniqueMounts);
     $mountIds = array_map(function ($mount) {
         return $mount['mount_id'];
     }, $uniqueMounts);
     $mountIds = array_values(array_unique($mountIds));
     $applicable = $this->getApplicableForMounts($mountIds);
     $config = $this->getConfigForMounts($mountIds);
     $options = $this->getOptionsForMounts($mountIds);
     return array_map(function ($mount, $applicable, $config, $options) {
         $mount['type'] = (int) $mount['type'];
         $mount['priority'] = (int) $mount['priority'];
         $mount['applicable'] = $applicable;
         $mount['config'] = $config;
         $mount['options'] = $options;
         return $mount;
     }, $uniqueMounts, $applicable, $config, $options);
 }