public function generate(Schema $schema, string $className, Context $context)
    {
        foreach ($schema->getClasses() as $class) {
            $properties = [];
            $methods = [];

            foreach ($class->getProperties() as $property) {
                $properties[] = $this->createProperty($property, $schema->getNamespace() . '\\Model');
                $methods[] = $this->createGetter($property, $schema->getNamespace() . '\\Model');
                $methods[] = $this->createSetter($property, $schema->getNamespace() . '\\Model');
            }

            $model = $this->createModel(
                $class->getName(),
                $properties,
                $methods,
                \count($class->getExtensionsType()) > 0
            );

            $namespace = new Stmt\Namespace_(new Name($schema->getNamespace() . '\\Model'), [$model]);

            $schema->addFile(new File($schema->getDirectory() . '/Model/' . $class->getName() . '.php', $namespace, self::FILE_TYPE_MODEL));
        }
    }
public function generate(Schema $schema, string $className, Context $context)
    {
        foreach ($schema->getClasses() as $class) {
            $properties = [];
            $methods = [];

            foreach ($class->getProperties() as $property) {
                $properties[] = $this->createProperty($property, $schema->getNamespace() . '\\Model');
                $methods[] = $this->createGetter($property, $schema->getNamespace() . '\\Model');
                $methods[] = $this->createSetter($property, $schema->getNamespace() . '\\Model');
            }

            $model = $this->createModel(
                $class->getName(),
                $properties,
                $methods,
                \count($class->getExtensionsType()) > 0
            );

            $namespace = new Stmt\Namespace_(new Name($schema->getNamespace() . '\\Model'), [$model]);

            $schema->addFile(new File($schema->getDirectory() . '/Model/' . $class->getName() . '.php', $namespace, self::FILE_TYPE_MODEL));
        }
    }
public function generate ( Schema $ schema , string $ className , Context $ context ) { foreach ( $ schema -> getClasses ( ) as $ class ) { $ properties = [ ] ; $ methods = [ ] ; foreach ( $ class -> getProperties ( ) as $ property ) { $ properties [ ] = $ this -> createProperty ( $ property , $ schema -> getNamespace ( ) . '\\Model' ) ; $ methods [ ] = $ this -> createGetter ( $ property , $ schema -> getNamespace ( ) . '\\Model' ) ; $ methods [ ] = $ this -> createSetter ( $ property , $ schema -> getNamespace ( ) . '\\Model' ) ; } $ model = $ this -> createModel ( $ class -> getName ( ) , $ properties , $ methods , \ count ( $ class -> getExtensionsType ( ) ) > 0 ) ; $ namespace = new Stmt \ Namespace_ ( new Name ( $ schema -> getNamespace ( ) . '\\Model' ) , [ $ model ] ) ; $ schema -> addFile ( new File ( $ schema -> getDirectory ( ) . '/Model/' . $ class -> getName ( ) . '.php' , $ namespace , self :: FILE_TYPE_MODEL ) ) ; } }
Generate a model given a schema.
Generate a model given a schema .