public static filterBuildableSchemas ( array $schemas ) | ||
$schemas | array |
public static function filterBuildableSchemas(array $schemas)
{
$list = array();
foreach ($schemas as $schema) {
// skip abstract classes.
if ($schema instanceof DynamicSchemaDeclare || $schema instanceof MixinDeclareSchema || !$schema instanceof SchemaDeclare && !$schema instanceof DeclareSchema) {
continue;
}
$rf = new ReflectionObject($schema);
if ($rf->isAbstract()) {
continue;
}
$list[] = $schema;
}
return $list;
}
public function __construct(BaseDriver $driver, PDO $connection) { $this->driver = $driver; $this->connection = $connection; $c = ServiceContainer::getInstance(); $this->config = $c['config_loader']; // pre-initialize all schema objects and expand template schema $this->schemas = SchemaUtils::findSchemasByConfigLoader($this->config, $c['logger']); $this->schemas = SchemaUtils::filterBuildableSchemas($this->schemas); // map table names to declare schema objects foreach ($this->schemas as $schema) { $this->schemaMap[$schema->getTable()] = $schema; } }