function it_applies_a_selector(DatasourceInterface $datasource, DatagridConfiguration $configuration, QueryBuilder $queryBuilder)
 {
     $datasource->getQueryBuilder()->willReturn($queryBuilder);
     $queryBuilder->getRootAlias()->willReturn('p');
     $queryBuilder->leftJoin('p.family', 'family')->willReturn($queryBuilder);
     $queryBuilder->leftJoin('family.translations', 'ft', 'WITH', 'ft.locale = :dataLocale')->willReturn($queryBuilder);
     $queryBuilder->addSelect('COALESCE(NULLIF(ft.label, \'\'), CONCAT(\'[\', family.code, \']\')) as familyLabel')->shouldBeCalled();
     $this->apply($datasource, $configuration);
 }
 function it_throws_an_exception_if_datasource_is_not_an_instance_of_productdatasource($parametersParser, DatagridInterface $grid, Acceptor $acceptor, MassActionExtension $massActionExtension, MassActionInterface $massActionInterface, DatasourceInterface $datasource, ProductMassActionRepositoryInterface $massActionRepository)
 {
     $massActionName = 'mass_edit_action';
     $request = new Request(['inset' => 'inset', 'values' => 1, 'gridName' => 'grid', 'massAction' => $massActionInterface, 'actionName' => $massActionName]);
     $parametersParser->parse($request)->willReturn(['inset' => 'inset', 'values' => 1]);
     $datasource->getMassActionRepository()->willReturn($massActionRepository);
     $massActionExtension->getMassAction($massActionName, $grid)->willReturn($massActionInterface);
     $acceptor->getExtensions()->willReturn([$massActionExtension]);
     $this->shouldThrow(new \LogicException('getRawFilters is only implemented for ProductDatasource'))->during('getRawFilters', [$request]);
 }
 /**
  * Retrieve entity ids, filters, sorters and limits are already in the datasource query builder
  *
  * @param DatasourceInterface $datasource
  *
  * @return array
  */
 protected function getEntityIds(DatasourceInterface $datasource)
 {
     $getIdsQb = clone $datasource->getQueryBuilder();
     $rootEntity = current($getIdsQb->getRootEntities());
     $rootAlias = $getIdsQb->getRootAlias();
     $rootField = $rootAlias . '.id';
     $getIdsQb->add('from', new From($rootEntity, $rootAlias, $rootField), false);
     $getIdsQb->groupBy($rootField);
     QueryBuilderUtility::removeExtraParameters($getIdsQb);
     $results = $getIdsQb->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
     return array_keys($results);
 }