Creates the model

@return \MUtil_Model_ModelAbstract
348167
protected function createModel()
    {
        $tracker = $this->loader->getTracker();
        $model   = $tracker->getRespondentTrackModel();

        if (! $this->trackEngine instanceof \Gems_Tracker_Engine_TrackEngineInterface) {
            if (! $this->respondentTrack) {
                $this->respondentTrack = $tracker->getRespondentTrack($this->respondentTrackId);
            }
            $this->trackEngine = $this->respondentTrack->getTrackEngine();
        }
        $model->applyEditSettings($this->trackEngine);

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

		return $instance;
	}
36183
public function create()
    {
        // Create Response Model
        $response = new ResponseModel();

        // return response
        $response->setData(collect($this->model->getFillable()));
        $response->setMessage($this->getTrans('create', 'successful'));
        return SmartResponse::response($response);
    }
1222894
public function create()
    {
        $instance = self::createWishList($this);
        $this->setId($instance->getId());
        return $instance;
    }
922479
public function store()
    {
        $class = $this->model;

        $this->validate(request(), $this->getValidationRules());

        // Create
        $model = new $class($this->input);
        return $model->save()
            ? [
                'success' => ucfirst($this->readableResourceType()) . ' created successfully.',
                'model' => $model->toArray(),
            ]
            : ['error' => 'There was a problem saving the ' . $this->readableResourceType() . '.'];
    }
260644
public function create()
    {
        $instance = self::createBrand($this);
        $this->setId($instance->getId());
        return $instance;
    }
285831
public function getModelInstance()
    {
        if ($this->instance !== null) {
            return $this->instance;
        }
        $model = $this->getModel();
        if ($model === false) {
            return false;
        }
        $instance = new $model();

        return $instance;
    }
113786
protected function createModel()
    {
        if (! $this->model instanceof \Gems_Model_StaffModel) {
            $this->model = $this->loader->getModels()->getStaffModel(false);
            $this->model->applyOwnAccountEdit();
        }

        return $this->model;
    }
392253
public function actionCreate()
    {
        $model = new \yongtiger\admin\models\Log();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('success', Module::t('message', 'Successfully created.'));
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
1072839
protected function createModel()
    {
        if (! $this->model instanceof RoundModel) {
            $this->model = $this->trackEngine->getRoundModel(false, 'index');
        }

        // Now add the joins so we can sort on the real name
        // $this->model->addTable('gems__surveys', array('gro_id_survey' => 'gsu_id_survey'));

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

        return $this->model;
    }
877688
public function createModel()
    {
        if (is_string($model = $this->getModel())) {
            if (! class_exists($class = '\\'.ltrim($model, '\\'))) {
                throw new RepositoryException("Class {$model} does NOT exist!");
            }

            $model = $this->getContainer()->make($class);
        }

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

        return $model;
    }
1003290
protected function createModel()
    {
        $groupby['period_1'] = new \Zend_Db_Expr("YEAR($this->dateFrom)");

        $date = new \MUtil_Date();

        switch ($this->dateType) {
            case 'D':
                $keyCount = 1;
                $groupby['period_1'] = new \Zend_Db_Expr("CONVERT($this->dateFrom, DATE)");

                $date->setTime(0);
                $date->addDay($this->dateFactor - $this->dateRange);

                $start = $date->getIso();
                for ($i = -$this->dateRange; $i <= $this->dateRange; $i++) {
                    if (0 == $i) {
                        $this->dateCurrentStart = clone $date;
                        $this->dateCurrentEnd   = clone $date;
                        $this->dateCurrentEnd->setTimeToDayEnd();
                    }

                    $values = array();
                    $values['period_1'] = $date->get('yyyy-MM-dd');
                    $values['range']    = $i;
                    $requiredRows[$i]   = $values;
                    $date->addDay(1);
                }
                $date->subSecond(1);
                $end = $date->getIso();
                break;

            case 'W':
                $keyCount = 2;

                // Use MONDAY as start of week
                $groupby['period_1'] = new \Zend_Db_Expr("substr(YEARWEEK(gto_valid_from, 3),1,4)");
                //$groupby['period_1'] = new \Zend_Db_Expr("YEAR($this->dateFrom) - CASE WHEN WEEK($this->dateFrom, 1) = 0 THEN 1 ELSE 0 END");
                $groupby['period_2'] = new \Zend_Db_Expr("WEEK($this->dateFrom, 3)");

                $date->setWeekday(1);
                $date->setTime(0);
                $date->addWeek($this->dateFactor - $this->dateRange);

                $start = $date->getIso();
                for ($i = -$this->dateRange; $i <= $this->dateRange; $i++) {
                    if (0 == $i) {
                        $this->dateCurrentStart = clone $date;
                        $this->dateCurrentEnd   = clone $date;
                        $this->dateCurrentEnd->addWeek(1)->subSecond(1);
                    }

                    $values = array();
                    $values['period_1'] = $date->get(\Zend_Date::YEAR);
                    $values['period_2'] = (int) $date->get(\Zend_Date::WEEK);   // Use constant but drop leading zero
                    // When monday is in the previous year, add one to the year
                    if ($date->get(\Zend_Date::DAY_OF_YEAR)>14 && $date->get(\Zend_Date::WEEK) == 1) {
                        $values['period_1'] =  $values['period_1'] + 1;
                    }
                    $values['range']    = $i;
                    $requiredRows[$i]   = $values;
                    $date->addWeek(1);
                }
                $date->subSecond(1);
                $end = $date->getIso();
                break;

            case 'M':
                $keyCount = 2;
                $groupby['period_2'] = new \Zend_Db_Expr("MONTH($this->dateFrom)");

                $date->setDay(1);
                $date->setTime(0);
                $date->addMonth($this->dateFactor - $this->dateRange);

                $start = $date->getIso();
                for ($i = -$this->dateRange; $i <= $this->dateRange; $i++) {
                    if (0 == $i) {
                        $this->dateCurrentStart = clone $date;
                        $this->dateCurrentEnd   = clone $date;
                        $this->dateCurrentEnd->addMonth(1)->subSecond(1);
                    }

                    $values = array();
                    $values['period_1'] = $date->get(\Zend_Date::YEAR);
                    $values['period_2'] = $date->get(\Zend_Date::MONTH);
                    $values['range']    = $i;
                    $requiredRows[$i]   = $values;
                    $date->addMonth(1);
                }
                $date->subSecond(1);
                $end = $date->getIso();
                break;

            case 'Y':
                $keyCount = 1;
                $date->setDay(1);
                $date->setMonth(1);
                $date->setTime(0);
                $date->addYear($this->dateFactor - $this->dateRange);
                $start = $date->getIso();
                for ($i = -$this->dateRange; $i <= $this->dateRange; $i++) {
                    if (0 == $i) {
                        $this->dateCurrentStart = clone $date;
                        $this->dateCurrentEnd   = clone $date;
                        $this->dateCurrentEnd->addYear(1)->subSecond(1);
                    }

                    $values = array();
                    $values['period_1'] = $date->get(\Zend_Date::YEAR);
                    $values['range']    = $i;
                    $requiredRows[$i]   = $values;
                    $date->addYear(1);
                }
                $date->subSecond(1);
                $end = $date->getIso();
                break;

            default:
                throw new \Gems_Exception_Coding('Incorrect date_type value: ' . $this->dateType);
        }
        $where = "$this->dateFrom BETWEEN '$start' AND '$end'";

        for ($i = -$this->dateRange; $i <= $this->dateRange; $i++) {
            $requiredRows[$i]['date_factor'] = $this->dateFactor + $i;
            $requiredRows[$i]['df_link']     = null;
            $requiredRows[$i]['df_label']    = null;
        }
        if ($this->dateRange > 0) {
            $requiredRows[-$this->dateRange]['df_link']  = $this->dateFactor - ($this->dateRange * 2);
            $requiredRows[-$this->dateRange]['df_label'] = $this->_('<<');
            $requiredRows[ $this->dateRange]['df_link']  = $this->dateFactor + ($this->dateRange * 2);
            $requiredRows[ $this->dateRange]['df_label'] = $this->_('>>');
            if ($this->dateRange > 1) {
                $i = intval($this->dateRange / 2);
                $requiredRows[-$i]['df_link']  = $this->dateFactor - 1;
                $requiredRows[-$i]['df_label'] = $this->_('<');
                $requiredRows[ $i]['df_link']  = $this->dateFactor + 1;
                $requiredRows[ $i]['df_label'] = $this->_('>');
            }
            $requiredRows[ 0]['df_link']  = $this->dateFactor ? '0' : null;
            $requiredRows[ 0]['df_label'] = $this->_('Now!');
        }

        if ($this->dateFactor) {
            $today = new \MUtil_Date();
            $this->dateFactorChanges['D'] = $this->dateCurrentStart->diffDays($today);
            $this->dateFactorChanges['W'] = $this->dateCurrentStart->diffWeeks($today);
            $this->dateFactorChanges['M'] = $this->dateCurrentStart->diffMonths($today);
            $this->dateFactorChanges['Y'] = $this->dateCurrentStart->diffYears($today);
        } else {
            $this->dateFactorChanges = array_fill_keys(array('D', 'W', 'M', 'Y'), 0);
        }
        // \MUtil_Echo::track($requiredRows);
        // \MUtil_Echo::rs($start, $end, $where);

        $select = new \Zend_Db_Select($this->db);
        $select->from($this->dataTableName, $groupby + $this->getDbFields());
        $select->where($where);
        $select->group($groupby);

        $this->processSelect($select);

        // \MUtil_Echo::r((string) $select);

        $model = new \MUtil_Model_SelectModel($select, $this->dataTableName);

        // Display by column cannot use formatFunction as it is a simple repeater
        // $model->set('duration_avg', 'formatFunction', $this->util->getLocalized()->formatNumber);

        $transformer = new \MUtil_Model_Transform_RequiredRowsTransformer();
        $transformer->setDefaultRow($this->getDefaultRow());
        $transformer->setRequiredRows($requiredRows);
        $transformer->setKeyItemCount($keyCount);
        $model->addTransformer($transformer);

        return $model;
    }
1022260
protected function createModel()
    {
        // Replace two checkboxes with on radio button control
        $this->model->set('ggp_staff_members', 'elementClass', 'Hidden');
        $this->model->setOnSave('ggp_staff_members', array($this, 'saveIsStaff'));
        $this->model->set('ggp_respondent_members', 'elementClass', 'Hidden');
        $this->model->setOnSave('ggp_respondent_members', array($this, 'saveIsRespondent'));

        $options = array(
            '1' => $this->model->get('ggp_staff_members', 'label'),
            '2' => $this->model->get('ggp_respondent_members', 'label')
            );
        $this->model->set('staff_respondent', 'label', $this->_('Can be assigned to'),
                'elementClass', 'Radio',
                'multiOptions', $options,
                'order', $this->model->getOrder('ggp_staff_members') + 1);
        $this->model->setOnLoad('staff_respondent', array($this, 'loadStaffRespondent'));

        return $this->model;
    }
63824
public function create()
	{
		$class = ($this->classClr) ? 'w50 clr' : 'w50';
		$class .= ($this->multiSelect) ? ' autoheight' : '';

		// Generate options
		$strGroup = 'default';
		foreach (StringUtil::deserialize($this->options) as $arrOption)
		{
			if ($arrOption['group'])
			{
				$strGroup = $arrOption['label'];
				continue;
			}	
			
			if ($arrOption['default'])
			{
				$default = 'v'.$arrOption['value']; // Add a alphabetic character to allow numeric values
			}	
			
			$arrOptions[$strGroup]['v'.$arrOption['value']] = $arrOption['label'];
		}
		
		// No groups 
		if (count($arrOptions) < 2)
		{
			$arrOptions = array_values($arrOptions)[0];
		}

		// Generate a select field
		$this->generateDCA(($this->multiSelect) ? 'multiSelectField' : 'singleSelectField', array
		(
			'inputType' 	=>	'select',
			'label'			=>	array($this->label, $this->description),
			'default'		=>	$default,
			'options'		=>	$arrOptions,
			'eval'			=>	array
			(
				'mandatory'				=> ($this->mandatory) ? true : false, 
				'includeBlankOption'	=> ($this->blankOption) ? true : false,
				'multiple'				=> ($this->multiSelect) ? true : false,
				'chosen'				=> true,
				'tl_class'				=> $class,
			),
		));
	}
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;
    }
1306009
protected function createModel() {
        if (!$this->model instanceof \Gems_Tracker_Model_StandardTokenModel) {
            $model = $this->loader->getTracker()->getTokenModel();
            $model->set('gto_id_token', 'label', $this->_('Summary'), 'formatFunction', array($this, 'getData'));
            $model->set('gsu_survey_name', 'label', $this->_('Survey'));
            $model->set('forgroup', 'label', $this->_('Filler'));
            $model->setKeys(array('gr2o_patient_nr', 'gto_id_organization'));

            $this->model = $model;
        }

        return $this->model;
    }
1317602
public function create()
    {
        $loaders = array();

        if (count($this->xmlMappings) > 1) {
            $loaders[] = new XmlFilesLoader($this->xmlMappings, $this->constraintNamespaces);
        } elseif (1 === count($this->xmlMappings)) {
            $loaders[] = new XmlFileLoader($this->xmlMappings[0], $this->constraintNamespaces);
        }

        if (count($this->yamlMappings) > 1) {
            $loaders[] = new YamlFilesLoader($this->yamlMappings, $this->constraintNamespaces);
        } elseif (1 === count($this->yamlMappings)) {
            $loaders[] = new YamlFileLoader($this->yamlMappings[0], $this->constraintNamespaces);
        }

        foreach ($this->methodMappings as $methodName) {
            $loaders[] = new StaticMethodLoader($methodName);
        }

        if ($this->annotationReader) {
            $loaders[] = new AnnotationLoader($this->annotationReader);
        }

        $loader = null;

        if (count($loaders) > 1) {
            $loader = new LoaderChain($loaders);
        } elseif (1 === count($loaders)) {
            $loader = $loaders[0];
        }

        return new LazyLoadingMetadataFactory($loader, $this->metadataCache);
    }