public function toModel(&$registry)
    {
        $metaData = $this->getMeta();
        $extends = $this->extends;

        $className = $this->name;

        // if we are loading migrations from disk we need to namespace different
        // so that we can be able to compare the two states. this way we avoid
        // possibility of loading the same state information about an app
        // i.e. we might end up always loading the state of the apps based on
        // whats currently shown the models
        if ($this->fromDisk) {
            $className = sprintf(
                '%s\\%s',
                Model::FAKENAMESPACE,
                $className
            );
            if ($extends) {
                $extends = sprintf(
                    '%s\\%s',
                    Model::FAKENAMESPACE,
                    $extends
                );
            }
        }

        $model = $this->createInstance(
            $className,
            $extends,
            ['registry' => $registry]
        );
        $fields = [];
        foreach ($this->fields as $name => $field) {
            $fields[$name] = $field->deepClone();
        }

        $model->setupClassInfo($fields, ['meta' => $metaData, 'registry' => $registry]);

        return $model;
    }
public function toModel(&$registry)
    {
        $metaData = $this->getMeta();
        $extends = $this->extends;

        $className = $this->name;

        // if we are loading migrations from disk we need to namespace different
        // so that we can be able to compare the two states. this way we avoid
        // possibility of loading the same state information about an app
        // i.e. we might end up always loading the state of the apps based on
        // whats currently shown the models
        if ($this->fromDisk) {
            $className = sprintf(
                '%s\\%s',
                Model::FAKENAMESPACE,
                $className
            );
            if ($extends) {
                $extends = sprintf(
                    '%s\\%s',
                    Model::FAKENAMESPACE,
                    $extends
                );
            }
        }

        $model = $this->createInstance(
            $className,
            $extends,
            ['registry' => $registry]
        );
        $fields = [];
        foreach ($this->fields as $name => $field) {
            $fields[$name] = $field->deepClone();
        }

        $model->setupClassInfo($fields, ['meta' => $metaData, 'registry' => $registry]);

        return $model;
    }
public function toModel ( & $ registry ) { $ metaData = $ this -> getMeta ( ) ; $ extends = $ this -> extends ; $ className = $ this -> name ; // if we are loading migrations from disk we need to namespace different // so that we can be able to compare the two states. this way we avoid // possibility of loading the same state information about an app // i.e. we might end up always loading the state of the apps based on // whats currently shown the models if ( $ this -> fromDisk ) { $ className = sprintf ( '%s\\%s' , Model :: FAKENAMESPACE , $ className ) ; if ( $ extends ) { $ extends = sprintf ( '%s\\%s' , Model :: FAKENAMESPACE , $ extends ) ; } } $ model = $ this -> createInstance ( $ className , $ extends , [ 'registry' => $ registry ] ) ; $ fields = [ ] ; foreach ( $ this -> fields as $ name => $ field ) { $ fields [ $ name ] = $ field -> deepClone ( ) ; } $ model -> setupClassInfo ( $ fields , [ 'meta' => $ metaData , 'registry' => $ registry ] ) ; return $ model ; }
Converts the current modelState into a model.

@param Registry $registry

@return Model

@throws TypeError
@throws \Eddmash\PowerOrm\Exception\FieldError
@throws \Eddmash\PowerOrm\Exception\LookupError
@throws \Eddmash\PowerOrm\Exception\MethodNotExtendableException

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
Converts the current modelState into a model .