/**
  * @param string $datasourceType
  *
  * @return string
  *
  * @throws InvalidConfigurationException
  */
 public function getAdapterClass($datasourceType)
 {
     if (DatasourceSupportResolver::DATASOURCE_SUPPORT_ORM === $this->supportResolver->getSupport($datasourceType)) {
         return $this->ormAdapterClass;
     } elseif (null === $this->mongodbAdapterClass) {
         throw new InvalidConfigurationException('The MongoDB adapter class should be registered.');
     }
     if (DatasourceSupportResolver::DATASOURCE_SUPPORT_MONGODB === $this->supportResolver->getSupport($datasourceType)) {
         return $this->mongodbAdapterClass;
     }
     return $this->ormAdapterClass;
 }
 /**
  * Reconfigure sorters
  *
  * @param BuildBefore $event
  */
 public function onBuildBefore(BuildBefore $event)
 {
     $config = $event->getConfig();
     $sortersPath = sprintf('%s[%s]', SorterConfiguration::SORTERS_PATH, Configuration::COLUMNS_KEY);
     $sorters = $config->offsetGetByPath($sortersPath);
     $datasourceType = $config->offsetGetByPath(Builder::DATASOURCE_TYPE_PATH);
     $sorterType = null;
     if (DatasourceTypes::DATASOURCE_PRODUCT === $datasourceType) {
         $sorterType = 'product_field';
     } elseif (DatasourceSupportResolver::DATASOURCE_SUPPORT_MONGODB === $this->supportResolver->getSupport($datasourceType)) {
         $sorterType = 'mongodb_field';
     }
     if (null === $sorterType) {
         return;
     }
     foreach ($sorters as $sorterName => $sorterConfig) {
         if (!isset($sorterConfig['sorter'])) {
             $config->offsetSetByPath(sprintf('%s[%s][sorter]', $sortersPath, $sorterName), $sorterType);
         }
     }
 }
 function let(DatasourceSupportResolver $supportResolver, PagerInterface $orm)
 {
     $supportResolver->getSupport(Argument::any())->willReturn(DatasourceSupportResolver::DATASOURCE_SUPPORT_MONGODB);
     $this->beConstructedWith($supportResolver, $orm);
 }
 function let(DatasourceSupportResolver $supportResolver)
 {
     $supportResolver->getSupport(Argument::any())->willReturn(DatasourceSupportResolver::DATASOURCE_SUPPORT_MONGODB);
     $this->beConstructedWith($supportResolver, 'orm_adapter_class');
 }