Create the phalcon model instance

@param  Model $model
@return PhalconModel
180693
protected function createTableModel(Model $model = null) {
		$phalconModel = new PhalconModel($this->getTableModelDi());
		$phalconModel->setDatagate($this);
		
		if ($model !== null) {
			$phalconModel->assign($model->getData());
		}
		
		return $phalconModel;
	}
19457
public function insertFrom($model)
	{
		$db = $this->getDb();
		$myCols = array_keys( $this->schemaColumnsGet() );
		$theirCols = $model->getColumnAliases();
		$columns = '('.implode( ',', array_map_val( array_intersect( $theirCols, $myCols ), $this->quoteColumnDg() ) ).')';
		$table = $this->quoteTable();
		$db->exec('INSERT INTO '.$table.' '.$columns.' '.$model->getSQL());
		$this->id = $this->getLastInsertId();
		if( $this->recordExists() )
		{
			return $this->filterById($this->id)->loadOne();
		}
		else
		{
			return $this;
		}
	}
1282351
public function setModel($model)
    {
        if ($model instanceof Model) {
            $this->model = $model;
        } else {
            $this->model = Yii::createObject($model);
        }

        $model = $this->model;
        $this->updateFormName();

        if (empty($this->getScenario())) {
            $this->setScenario($model->scenario);
        }

        return $this->model;
    }
61670
public function newModel($attributes = [], $model = null)
    {
        $model = (class_exists($model) ? $model : $this->schema->entryModel());

        if (! is_subclass_of($model, $base = Model::class)) {
            throw new InvalidArgumentException("The given model class '{$model}' must extend the base model class '{$base}'");
        }

        return new $model($attributes, $this->builder->newInstance());
    }
919865
public function setModel(Model $model)
    {
        if (strpos($this->originalName, '.') !== false) {
            $parts = explode('.', $this->originalName);
            $name = array_pop($parts);

            while ($parts) {
                $part = array_shift($parts);
                $relation = $model->getAttribute($part);

                if ($relation instanceof Model) {
                    $model = $relation;
                    $this->setName($name);
                }
            }
        }

        return parent::setModel($model);
    }
738319
private function create($model)
    {
        $attrs = $this->getMutableAttributes($model);
        $this->db
            ->connect()
            ->insert($this->table, array_keys($attrs))
            ->execute(array_values($attrs));
        $model->{$this->key} = $this->db->lastInsertId();
    }
1319030
protected function buildModel($model)
    {
        try {
            $query = $this->resolveQueryBuilderFromModel($model);
        } catch (InvalidArgumentException $e) {
            $query = $model;
        }

        if ($this->paginate === true && \method_exists($query, 'paginate')) {
            $query = $query->paginate($this->perPage, ['*'], $this->pageName);
        } elseif ($this->isQueryBuilder($query)) {
            $query = $query->get();
        }

        return $query;
    }
621498
public function create(): Model
	{
		$model_class = $this->getModelClass();
		$instance = new $model_class;
		$this->fill($instance);

		return $instance;
	}
1081700
public function setModel($model)
	{
		$this->model = $model;
		
		$this->from($this->model->metableTable() . ' AS m');
		
		if ($this->model->metableTableSoftDeletes()) {
			$this->whereNull('m.' . $this->model->getDeletedAtColumn());
		}
		
		return $this;
	}
663574
public function createTable(ModelInterface $model)
    {
        $i = 0;

        $model->setConnection($this->connection);

        $schemaManager = $this->connection->getSchemaManager();
        $builder = $this->getQueryBuilder();
        $tableName = TableNameResolver::getTableName($model->tableName());

        $columns = [];
        $indexes = [];

        foreach ($model->getMeta()->getFields() as $name => $field) {
            $field->setModel($model);

            if ($field instanceof ManyToManyField) {
                $field->setConnection($this->connection);

                /* @var $field \Mindy\Orm\Fields\ManyToManyField */
                if (null === $field->through) {
                    $fieldTableName = TableNameResolver::getTableName($field->getTableName());
                    if (false === $this->hasTable($fieldTableName)) {
                        $fieldTable = new Table(
                            $fieldTableName,
                            $field->getColumns()
                        );
                        $schemaManager->createTable($fieldTable);
                        $i += 1;
                    }
                }
            } else {
                $column = $field->getColumn();
                if (empty($column)) {
                    continue;
                }

                $columns[] = $column;
                $indexes = array_merge($indexes, $field->getSqlIndexes());
            }
        }

        if (false === $this->hasTable($tableName)) {
            $table = new Table($tableName, $columns, []);
            $table->setPrimaryKey($model->getPrimaryKeyName(true), 'primary');
            $schemaManager->createTable($table);

            $i += 1;
        }

        return $i;
    }
768606
public function create( $model, $config = [] ) {

		$model = parent::create( $model, $config );

		$content = isset( $config[ 'content' ] ) ? $config[ 'content' ] : null;

		// Model content is required for all the tags to form tag page
		if( !isset( $content ) ) {

			$content = new ModelContent();
		}

		$config[ 'parent' ]		= $model;
		$config[ 'parentType' ]	= self::$parentType;

		$this->modelContentService->create( $content, $config );

		return $model;
	}
306243
public function model($model)
    {
        #$model = ucfirst($model).'Model';
        $modelPath = self::$instance->app->findModel($model);
        $modelClass = "App\\Model\\".$model;
        $this->model = new $modelClass();
        self::$instance->modelService = new ModelService();
        self::$instance->modelService->initialize(self::$instance->app);
        return $this->model;
        //$appModel->handleModel($controller, $method);
    }
614549
protected function getModuleByModel(Model $model)
    {
        /** @var ModuleManagerInterface $modules */
        $modules = app(ModuleManagerInterface::class);

        return $modules->getByAssociatedClass(get_class($model));
    }
1223527
public static function createTagFromModel(Model $model)
    {
        return new Tag((string) $model->id, $model->name, $model->row());
    }
1254008
public function create( $model, $config = [] ) {

		$modelClass = static::$modelClass;

		// Default New
		$model->status = $model->status ?? $modelClass::STATUS_NEW;

		// Create Model
		return parent::create( $model, $config );
	}
724174
public function setModel(\Parable\ORM\Model $model)
    {
        $this->model = $model->reset();
        return $this;
    }
488897
public function getNewStore(\PhalconRest\API\BaseModel $model): \PhalconRest\Rules\Store
    {
        $newStore = new \PhalconRest\Rules\Store($model);
        //force store to match registry enforcement setting
        if ($this->enforceRules) {
            $newStore->enable();
        } else {
            $newStore->disable();
        }
        return $newStore;
    }