Creates a completely new data model.
Any Properties not explicitly described for this object will be ignored

@param type $dataModel
555502
final public function definePropertyModel($dataModel = array(), $objectType = "object")
    {

        $this->propertyModel = $dataModel;
        $this->setObjectType($objectType);

        return $this;
    }
1186811
public function prepareModelData(AbstractModel $model, MySQLTableData $tableData)
    {
        $data    = $columData = [];
        $keyList = $tableData->getPrimaryKey();
        $reflection        = new \ReflectionClass($model);

        foreach ($tableData->getColumnNames() as $column) {

            try {
                $reflectedProperty = $reflection->getProperty($column);


                $reflectedProperty->setAccessible(true);

                $columData = [
                    'value' => $reflectedProperty->getValue($model),
                    'name'  => $column
                ];

                if (in_array($column, $keyList)) {
                    array_merge($columData, ['KEY' => true]);
                }
                $data[] = $columData;
            } catch (\Exception $e) {
                $logger = \chilimatic\lib\di\ClosureFactory::getInstance()->get('error-log');
                $logger->error($e->getMessage(), $e->getTraceAsString());
            }
        }

        return $data;
    }
786469
protected function prepareDataProvider($model)
    {
        $query = $this->getQuery($model);

        if ($model instanceof ActiveSearchInterface) {
            return $model->search($query);
        }

        return new ActiveDataProvider([
            'query' => $query,
            'pagination' => [],
        ]);
    }
357512
public function setup(DispatchModel $dispatchModel) {
		foreach ($this->dispatchables as $key => $dispatchable) {
			$dispatchModel->addProperty(new ObjectProperty(new DynamicAccessProxy($key), false));
		}
	}
976899
protected function createModel($data) {
		$modelClass = $this->getModel();
			
		$model = $modelClass::factory($data);

		if ($this->hasDatagate()) {
			$model->setDatagate($this->getDatagate());
		}
		
		if ($this->hasLocator()) {
			$model->setLocator($this->getLocator());
		}
		
		return $model;
	}
391790
public static function insertModel($model)
    {
        foreach(AnnotationManager::getPropertiesAnnotations(BeanFactory::getObjectClass($model), RelationBase::class) as $propertyName => $annotations)
        {
            if(null === $model[$propertyName])
            {
                continue;
            }
            $annotation = $annotations[0];
            Insert::parse($model, $propertyName, $annotation);
        }
    }
50188
public function createClonedModel($model)
    {
        $clone = clone $model;
        $clone->setId(null);

        $environment  = $this->getEnvironment();
        $properties   = $environment->getDataDefinition()->getPropertiesDefinition();
        $dataProvider = $environment->getDataProvider($clone->getProviderName());

        foreach (\array_keys($clone->getPropertiesAsArray()) as $propName) {
            // If the property is not known, remove it.
            if (!$properties->hasProperty($propName)) {
                continue;
            }

            $property = $properties->getProperty($propName);
            $this->handleClonedModelProperty($clone, $property, $dataProvider);
        }

        return $clone;
    }
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();
    }
471896
private function createStructureModelWith(
        MetadataInterface $metadata,
        array ...$datasets
    ) {
        $model = $this->createStructureModel();
        if (!$model instanceof DescribableInterface) {
            throw new UnexpectedValueException(sprintf(
                'Structure [%s] must implement [%s]',
                get_class($model),
                DescribableInterface::class
            ));
        }

        $model->setMetadata($metadata);

        if ($datasets) {
            foreach ($datasets as $data) {
                $model->setData($data);
            }
        }

        return $model;
    }
461850
public static function newFromEloquentObject(EloquentModel $eloquentModel)
    {
        $rc = new ReflectionClass(static::class);
        $entity = $rc->newInstanceWithoutConstructor();

        // get model data
        $dict = [
            'mapping' => $eloquentModel->getMapping(),
            'attributes' => $eloquentModel->getAttributes(),
            'relations' => $eloquentModel->getRelations()
        ];

        // attributes
        foreach ($dict['mapping']['attributes'] as $attribute => $column) {
            $entity->{$attribute} = $dict['attributes'][$column];
        }

        // embeddeds
        foreach ($dict['mapping']['embeddeds'] as $name => $embedded) {
            $entity->{$name} = $embedded['class']::newFromEloquentObject($eloquentModel, $name);
        }

        // relations
        foreach ($dict['mapping']['relations'] as $name => $relation) {
            // set relation object
            if (! empty($dict['relations'][$name])) {
                $relationObject = $dict['relations'][$name]->toDatamapperObject();
            } elseif (in_array($relation['type'], $eloquentModel->manyRelations)) {
                $relationObject = new ProxyCollection;
            } else {
                $relationObject = new Proxy;
            }
            
            $entity->{$name} = $relationObject;
        }

        return $entity;
    }
323086
public function createModel($className, $data)
    {
        $model = new $className;

        foreach ($data as $managerName => $value) {
            $is_collection = is_array($value);

            if ($is_collection) {
                $method_name = 'get' . ucfirst($managerName);
            } else {
                $method_name = 'set' . ucfirst($managerName);
            }

            if (!method_exists($model, $method_name)) {
                throw new \RuntimeException(sprintf('Method "%s" does not exist in "%s" class.', $method_name, $className));
            }

            if ($is_collection) {
                foreach ($value as $element) {
                    $model->$method_name()->add($element);
                }
            } else {
                $model->$method_name($value);
            }
        }

        return $model;
    }
602398
public static function newFromEloquentObject(EloquentModel $eloquentModel, $name)
    {
        $rc = new ReflectionClass(static::class);
        $valueObject = $rc->newInstanceWithoutConstructor();

        // get model data
        $dict = [
            'mapping' => $eloquentModel->getMapping(),
            'attributes' => $eloquentModel->getAttributes()
        ];

        foreach ($dict['mapping']['embeddeds'][$name]['attributes'] as $attribute => $column) {
            $valueObject->{$attribute} = $dict['attributes'][$column];
        }

        return $valueObject;
    }
491246
public function setPage(PageDataModel $pageModel)
    {
        $pageModel
            ->setModified(new \DateTime())
            ->setEntityManager($this)
            ->save();

        return true;
    }
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;
    }
1251977
public function makeModel($storeModel = true)
    {
        $model = $this->app->make($this->model());

        if ( ! $model instanceof Model) {
            throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
        }

        if ($storeModel) $this->model = $model;

        return $model;
    }
348790
public function collectDetails($viewModel)
    {
        if (checkDebugbar()) {
            $debugbar = app('debugbar');

            if ($debugbar->shouldCollect('auto_views')) {
                $debugbar['auto_views']->addDetails($viewModel);
            }
        }
    }
505276
public function injectDataMapper(DataMapper $dataMapper)
    {
        $this->dataMapper = $dataMapper;
        $this->dataMapper->setPersistenceManager($this);
    }