示例#1
0
 protected function setUp()
 {
     $this->app = new Application();
     $this->app->register(new TwigServiceProvider());
     $twigExtensions = new TwigExtensions();
     $twigExtensions->registerTwigExtensions($this->app);
 }
示例#2
0
 /**
  * Initializes the instance.
  *
  * @param DataFactoryInterface $dataFactory
  * the factory to create the concrete AbstractData instances
  * @param string $crudFile
  * the CRUD YAML file to parse
  * @param FileProcessorInterface $fileProcessor
  * the file processor used for file fields
  * @param boolean $manageI18n
  * holds whether we manage the i18n
  * @param Container $app
  * the application container
  */
 public function init(DataFactoryInterface $dataFactory, $crudFile, FileProcessorInterface $fileProcessor, $manageI18n, Container $app)
 {
     $parsedYaml = $this->readYaml($crudFile);
     $this->validateEntityDefinition($app, $parsedYaml);
     $this->initMissingServiceProviders($app);
     $this->manageI18n = $manageI18n;
     $locales = $this->initLocales($app);
     $this->datas = [];
     foreach ($parsedYaml as $name => $crud) {
         $definition = $this->createDefinition($app, $locales, $crud, $name);
         $this->datas[$name] = $dataFactory->createData($definition, $fileProcessor);
     }
     $twigExtensions = new TwigExtensions();
     $twigExtensions->registerTwigExtensions($app);
     $this->initChildren();
 }