Ejemplo n.º 1
0
 function it_throws_an_exception_if_driver_is_not_supported(Grid $grid, ServiceRegistryInterface $driversRegistry)
 {
     $parameters = new Parameters();
     $grid->getDriver()->willReturn('doctrine/banana');
     $driversRegistry->has('doctrine/banana')->willReturn(false);
     $this->shouldThrow(new UnsupportedDriverException('doctrine/banana'))->during('getDataSource', [$grid, $parameters]);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getDataSource(Grid $grid, Parameters $parameters)
 {
     $driver = $grid->getDriver();
     if (!$this->driversRegistry->has($driver)) {
         throw new UnsupportedDriverException($driver);
     }
     return $this->driversRegistry->get($driver)->getDataSource($grid->getDriverConfiguration(), $parameters);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getDataSource(Grid $grid, Parameters $parameters)
 {
     $driverName = $grid->getDriver();
     if (!$this->driversRegistry->has($driverName)) {
         throw new UnsupportedDriverException($driverName);
     }
     /** @var DriverInterface $driver */
     $driver = $this->driversRegistry->get($driverName);
     return $driver->getDataSource($grid->getDriverConfiguration(), $parameters);
 }