init() public method

Initializes the instance.
public init ( crudlex\DataFactoryInterface $dataFactory, string $crudFile, crudlex\FileProcessorInterface $fileProcessor, boolean $manageI18n, Pimple\Container $app )
$dataFactory crudlex\DataFactoryInterface the factory to create the concrete AbstractData instances
$crudFile string the CRUD YAML file to parse
$fileProcessor crudlex\FileProcessorInterface the file processor used for file fields
$manageI18n boolean holds whether we manage the i18n
$app Pimple\Container the application container
Esempio n. 1
0
 public static function createServiceProvider($useUUIDs = false)
 {
     static::$fileProcessorHandle = Phony::mock('\\CRUDlex\\SimpleFilesystemFileProcessor');
     static::$fileProcessorHandle->renderFile->returns('rendered file');
     $fileProcessorMock = static::$fileProcessorHandle->get();
     $app = static::createAppAndDB($useUUIDs);
     $crudServiceProvider = new ServiceProvider();
     $dataFactory = new MySQLDataFactory($app['db'], $useUUIDs);
     $crudFile = __DIR__ . '/../crud.yml';
     $crudServiceProvider->init($dataFactory, $crudFile, $fileProcessorMock, true, $app);
     return $crudServiceProvider;
 }
Esempio n. 2
0
 public static function createServiceProvider($useManyToMany)
 {
     self::$fileProcessor = new NullFileProcessor();
     $app = self::createAppAndDB($useManyToMany);
     $crudServiceProvider = new ServiceProvider();
     $dataFactory = new MySQLDataFactory($app['db']);
     $crudFile = __DIR__ . '/../' . ($useManyToMany ? 'crudManyToMany.yml' : 'crud.yml');
     $crudServiceProvider->init($dataFactory, $crudFile, self::$fileProcessor, true, $app);
     $userSetup = new UserSetup();
     $userSetup->addEvents($crudServiceProvider->getData('user'));
     return $crudServiceProvider;
 }
Esempio n. 3
0
 public function testSetLocale()
 {
     $serviceProvider = new ServiceProvider();
     $app = new Application();
     $serviceProvider->init($this->dataFactory, $this->crudFile, $this->fileProcessorMock, true, $app);
     $serviceProvider->setLocale('de');
     $read = $serviceProvider->getData('library')->getDefinition()->getLocale();
     $expected = 'de';
     $this->assertSame($expected, $read);
     $read = $serviceProvider->getData('book')->getDefinition()->getLocale();
     $this->assertSame($expected, $read);
 }