public function generate($schema, $className, Context $context)
    {
        $files = [];

        foreach ($schema->getClasses() as $class) {
            $properties = [];
            $methods    = [];

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

            $model = $this->createModel(
                $class->getName(),
                $properties,
                $methods
            );

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

            $files[] = new File($schema->getDirectory().'/Model/'.$class->getName().'.php', $namespace, self::FILE_TYPE_MODEL);
        }

        return $files;
    }
public function generate($schema, $className, Context $context)
    {
        $files = [];

        foreach ($schema->getClasses() as $class) {
            $properties = [];
            $methods    = [];

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

            $model = $this->createModel(
                $class->getName(),
                $properties,
                $methods
            );

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

            $files[] = new File($schema->getDirectory().'/Model/'.$class->getName().'.php', $namespace, self::FILE_TYPE_MODEL);
        }

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

@param Schema  $schema     Schema to generate from
@param string  $className  Class to generate
@param Context $context    Context for generation

@return File[]
Generate a model given a schema