lazyrecord\schema\SchemaGenerator::generate PHP Method

generate() public method

Given a schema class list, generate schema files.
public generate ( array $schemas ) : array
$schemas array
return array class map array of schema class and file path.
    public function generate(array $schemas)
    {
        // class map [ class => class file path ]
        $classMap = array();
        foreach ($schemas as $schema) {
            $generated = $this->generateSchemaFiles($schema);
            if (!empty($generated)) {
                $classMap = array_merge($classMap, $generated);
            }
        }
        return $classMap;
    }

Usage Example

Beispiel #1
0
 public function execute()
 {
     $logger = $this->getLogger();
     $config = $this->getConfigLoader();
     $this->logger->debug('Finding schemas...');
     $classes = $this->findSchemasByArguments(func_get_args());
     SchemaUtils::printSchemaClasses($classes, $this->logger);
     $this->logger->debug("Initializing schema generator...");
     $generator = new SchemaGenerator($config, $this->logger);
     if ($this->options->force) {
         $generator->setForceUpdate(true);
     }
     $classMap = $generator->generate($classes, $this->options->force);
     /*
     foreach( $classMap as $class => $file ) {
         $path = $file;
         if ( strpos( $path , getcwd() ) === 0 ) {
             $path = substr( $path , strlen(getcwd()) + 1 );
         }
         $logger->info($path);
         // $logger->info(sprintf("%-32s",ltrim($class,'\\')) . " => $path",1);
     }
     */
     $logger->info('Done');
 }
All Usage Examples Of lazyrecord\schema\SchemaGenerator::generate