Creates the model

@return \MUtil_Model_ModelAbstract
496969
protected function createModel()
    {
        if ($this->model instanceof \Gems_Tracker_Model_StandardTokenModel) {
            $model = $this->model;
        } else {
            $model = $this->loader->getTracker()->getTokenModel();
        }
        $model->addColumn(
            'CASE WHEN gto_completion_time IS NULL THEN gto_valid_from ELSE gto_completion_time END',
            'calc_used_date',
            'gto_valid_from');
        $model->addColumn(
            'CASE WHEN gto_completion_time IS NULL THEN gto_valid_from ELSE NULL END',
            'calc_valid_from',
            'gto_valid_from');
        $model->addColumn(
            'CASE WHEN gto_completion_time IS NULL AND grc_success = 1 AND gto_valid_from <= CURRENT_TIMESTAMP AND gto_completion_time IS NULL AND (gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP) THEN gto_id_token ELSE NULL END',
            'calc_id_token',
            'gto_id_token');
        $model->addColumn(
            'CASE WHEN gto_completion_time IS NULL AND grc_success = 1 AND gto_valid_from <= CURRENT_TIMESTAMP AND gto_completion_time IS NULL AND gto_valid_until < CURRENT_TIMESTAMP THEN 1 ELSE 0 END',
            'was_missed');
        return $model;
    }
907529
protected function create()
    {
        $this->preCreate();
        $this->data = $this->api->create($this->data);
        $this->id   = $this->data['id'];
        $this->postCreate();

        return $this;
    }
451631
protected function createModel()
    {
        $model = parent::createModel();

        foreach ($model->getItemNames() as $name) {
            if (! $model->has($name, 'label')) {
                $model->set($name, 'label', ' ');
            }
        }

        return $model;
    }
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;
	}
1201351
public function createModel($model)
    {
        $schema = new Schema();

        $tableDef = $schema->createTable($model->getMeta()->getDbTable());
        // this assumes fields set_from_name has been invoked
        $primaryKeyFields = [];
        $unique_fields = [];
        $indexes = [];
        /** @var $field Field */
        /** @var $field ForeignKey */
        foreach ($model->getMeta()->localFields as $fname => $field) {
            $colName = $field->getColumnName();
            $type = $field->dbType($this->connection);
            // if we don't have a type skip
            if (empty($type)) {
                continue;
            }
            if ($field->primaryKey) {
                $primaryKeyFields[] = $model->getMeta()->primaryKey->getColumnName();
            } elseif ($field->isUnique()) {
                $unique_fields[] = $colName;
            } elseif ($field->dbIndex) {
                $indexes[] = $colName;
            }
            $tableDef->addColumn($colName, $type, $this->getDoctrineColumnOptions($field));
            if ($field->isRelation && $field->relation && $field->dbConstraint) {
                $relField = $field->getRelatedField();
                $tableDef->addForeignKeyConstraint(
                    $relField->scopeModel->getMeta()->getDbTable(),
                    [$field->getColumnName()],
                    [$relField->getColumnName()]
                );
            }
        }
        // create the primary key
        $tableDef->setPrimaryKey($primaryKeyFields);
        // add index constraint
        if (!empty($indexes)) {
            $tableDef->addIndex($indexes);
        }
        // add unique constraint
        if (!empty($unique_fields)) {
            $tableDef->addUniqueIndex($unique_fields);
        }
        $this->createTable($tableDef);
        // many to many
        /** @var $relationField ManyToManyField */
        foreach ($model->getMeta()->localManyToMany as $name => $relationField) {
            if ($relationField->manyToMany && $relationField->relation->through->getMeta()->autoCreated) {
                $this->createModel($relationField->relation->through);
            }
        }
    }
29776
public function create()
    {
        $instance = self::createRefundTransaction($this);
        $this->setId($instance->getId());
        return $instance;
    }
1219158
protected function createModel()
    {
        if (! $this->_model instanceof RoundModel) {
            $this->_model = new RoundModel();

            $this->_model->addTable('gems__tracks', ['gro_id_track' => 'gtr_id_track']);
            $this->_model->addTable('gems__surveys', ['gro_id_survey' => 'gsu_id_survey']);
            $this->_model->addLeftTable('gems__groups', ['gsu_id_primary_group' => 'ggp_id_group']);

            $this->_model->addColumn("CASE WHEN gro_active = 1 THEN '' ELSE 'deleted' END", 'row_class');

            $this->_model->set('gro_id_round');
            $this->_model->set('gtr_track_name',        'label', $this->_('Track name'));
            $this->_model->set('gro_id_order',          'label', $this->_('Round order'));
            $this->_model->set('gro_round_description', 'label', $this->_('Description'));
            $this->_model->set('gsu_survey_name',       'label', $this->_('Survey'));
            $this->_model->set('ggp_name',              'label', $this->_('Assigned to'));
            $this->_model->set('gro_active',            'label', $this->_('Active'),
                    'multiOptions', $this->util->getTranslated()->getYesNo());
        }

        // Now add the joins so we can sort on the real name
        //

        // $this->model->set('gsu_survey_name', $this->model->get('gro_id_survey'));

        return $this->_model;
    }
988411
public function create()
    {
        $this->resource = imagecreatetruecolor($this->width, $this->height);
        imagesavealpha($this->resource, true);

        $color = imagecolorallocatealpha(
            $this->resource,
            $this->red,
            $this->green,
            $this->blue,
            null
        );

        if ($this->figureType == 'rectangle') {
            $this->createRectangle($color);
        }

        if ($this->figureType == 'ellipse') {
            $this->createEllipse($color);
        }

        $this->addOpacityFilter();

        return $this;
    }
771890
protected function createModel()
    {
        if ($this->model instanceof \Gems_Model_RespondentModel) {
            $model = $this->model;

        } else {
            if ($this->respondent instanceof \Gems_Tracker_Respondent) {
                $model = $this->respondent->getRespondentModel();

            } else {
                $model = $this->loader->getModels()->getRespondentModel(true);;
            }
            $model->applyDetailSettings();
        }

        return $model;
    }
1329664
protected function create()
    {
        $this->setReleaseVersion();

        $output = $this->getDestination() . '/' . $this->getFilename();

        $phar = new Phar($output, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME);
        $phar->buildFromDirectory(Context::getParam('project-root'), $this->options['excluded-paths']);
        $phar->setMetadata(array_merge(array('version' => $this->releaseVersion), $this->options['metadata']));
        $phar->setDefaultStub($this->options['default-stub-cli'], $this->options['default-stub-web']);

        return $output;
    }
179549
public function getModel()
    {
        $modelData = is_resource($this->model_data)
            ? stream_get_contents($this->model_data)
            : $this->model_data;

        $model = new $this->versionable_type();
        $model->unguard();
        $model->fill(unserialize($modelData));
        $model->exists = true;
        $model->reguard();
        return $model;
    }
1219601
public function create()
    {
        $sm = $this->em->getConnection()->getSchemaManager();
        $table = $this->em->getClassMetadata(self::$entityName)->getTableName();

        return $sm->tablesExist(array($table));
    }
811778
protected function createModel()
    {
        if (! $this->model instanceof FieldMaintenanceModel) {
            $this->model = $this->trackEngine->getFieldsMaintenanceModel(false, 'index');
        }

        return $this->model;
    }
795710
public function asModels()
    {
        $this->hydrate();

        return new ModelCollection(array_map(function ($element, $key) {

            // Add the key as an attribute
            return new $this->model(array_merge($element, ['key' => $key]));
        }, $this->all(), array_keys($this->items)));
    }
83701
public function create()
    {
        if (! empty($this->module_name = (string) request('module_name'))) {
            \Lang::addJsonPath(skin_path('lang' . DS . $this->module_name));
        }

        return $this->makeResponse('create', [
            'setting' => (object) [ // collect
                'module_name' => $this->module_name ?? null,
            ],
            'modules' => $this->modules->all(),
            'field_types' => $this->field_types,
            'datalist' => (object) [
                'sections' => $this->module_name
                    ? $this->model::getSections($this->module_name) : [],
                'fieldsets' => $this->module_name
                    ? $this->model::getFieldsets($this->module_name) : [],
            ],
        ]);
    }
69762
protected function createModel()
    {
        $translated = $this->util->getTranslated();

        $model = new \MUtil_Model_TableModel('gems__tracks');

        $model->set('gtr_track_name',    'label', $this->_('Track'));
        $model->set('gtr_survey_rounds', 'label', $this->_('Survey #'));
        $model->set('gtr_date_start',    'label', $this->_('From'),
                'dateFormat', $translated->formatDate,
                'tdClass', 'date'
                );
        $model->set('gtr_date_until',    'label', $this->_('Until'),
                'dateFormat', $translated->formatDateForever,
                'tdClass', 'date'
                );

        return $model;
    }
534431
protected function createModel()
    {
        if (! $this->model instanceof \Gems_Tracker_Model_TrackModel) {
            $this->model = $this->loader->getTracker()->getTrackModel();
        }

        return $this->model;
    }