buildConfigSeeds() public method

public buildConfigSeeds ( ConfigLoader $config )
$config ConfigLoader
Exemplo n.º 1
0
 public function seed(array $schemas, ConfigLoader $config = null)
 {
     $seedBuilder = new SeedBuilder($this->logger);
     $seedBuilder->build(new SchemaCollection($schemas));
     if ($config) {
         $seedBuilder->buildConfigSeeds($config);
     }
 }
Exemplo n.º 2
0
 public function execute()
 {
     $options = $this->options;
     $logger = $this->logger;
     $classes = SchemaUtils::findSchemasByArguments($this->getConfigLoader(), func_get_args(), $this->logger);
     SchemaUtils::printSchemaClasses($classes, $this->logger);
     $collection = new SchemaCollection($classes);
     $collection = $collection->evaluate();
     $seedBuilder = new SeedBuilder($this->logger);
     $seedBuilder->build($collection);
     $seedBuilder->buildConfigSeeds($this->getConfigLoader());
     $this->logger->info('Done');
 }
Exemplo n.º 3
0
 public function setUp()
 {
     if ($this->onlyDriver !== null && $this->getDataSource() != $this->onlyDriver) {
         return $this->markTestSkipped("{$this->onlyDriver} only");
     }
     $this->prepareConnection();
     // Ensure that we use the correct default data source ID
     $this->assertEquals($this->getDataSource(), $this->config->getDefaultDataSourceId());
     $this->assertInstanceOf('SQLBuilder\\Driver\\BaseDriver', $this->queryDriver, 'QueryDriver object OK');
     // Rebuild means rebuild the database for new tests
     $annnotations = $this->getAnnotations();
     $rebuild = true;
     $basedata = true;
     if (isset($annnotations['method']['rebuild'][0]) && $annnotations['method']['rebuild'][0] == 'false') {
         $rebuild = false;
     }
     if (isset($annnotations['method']['basedata'][0]) && $annnotations['method']['basedata'][0] == 'false') {
         $basedata = false;
     }
     $schemas = ClassUtils::schema_classes_to_objects($this->getModels());
     if (false === $this->schemaHasBeenBuilt) {
         $g = new SchemaGenerator($this->config);
         $g->setForceUpdate(true);
         $g->generate($schemas);
         $this->schemaHasBeenBuilt = true;
     }
     if ($rebuild === false) {
         $tableParser = TableParser::create($this->conn, $this->queryDriver, $this->config);
         $tables = $tableParser->getTables();
         $schemas = array_filter($schemas, function ($schema) use($tables) {
             return !in_array($schema->getTable(), $tables);
         });
     }
     $this->sqlBuilder = SqlBuilder::create($this->queryDriver, array('rebuild' => $rebuild));
     $this->bootstrap = new Bootstrap($this->conn, $this->sqlBuilder, $this->logger);
     $this->bootstrap->build($schemas);
     if ($rebuild && $basedata) {
         $seeder = new SeedBuilder($this->logger);
         $seeder->build(new SchemaCollection($schemas));
         $seeder->buildConfigSeeds($this->config);
     }
 }