Creates the model

@return \MUtil_Model_ModelAbstract
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;
    }
245308
protected function createModel()
    {
        $model = new SearchPanelModel();

        $model->searchControls = $this->createSearchControls();

        $model->urlStateNames = $this->getUrlStateNames($model->searchControls);

        // Pass through of searchedEvent
        $this->searchedEvent = $model->searchedEvent;

        return $model;
    }
81431
protected function buildModel()
    {
        $config = $this->getGeneratorConfig();
        $con = $this->getConnection();

        $this->log('Reading database structure...');

        $database = new Database($this->getDatabaseName());
        $database->setPlatform($config->getConfiguredPlatform($con));
        $database->setDefaultIdMethod(IDMethod::NATIVE);
        $parser = $config->getConfiguredSchemaParser($con);
        $nbTables = $parser->parse($database, $this);

        $this->log(sprintf('Successfully reverse engineered %d tables', $nbTables));

        return $database;
    }
31503
protected function newModelInstance()
    {
        if (is_null($this->fullModelClassName)) {
            $this->fullModelClassName = $this->model();
        }

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

        return $this->model;
    }
216384
public function createModel()
    {
        $file = '<?php'.$this->namespace.LF.LF;

        $file .= '/**'.LF;
        $file .= ' * Eloquent class to describe the '.$this->table.' table'.LF;
        $file .= ' *'.LF;
        $file .= ' * automatically generated by ModelGenerator.php'.LF;
        $file .= ' */'.LF;

        // a new class that extends the provided baseModel
        $file .= 'class '.$this->class.' extends '.$this->baseModel.LF;
        $file .= '{'.LF;

        // the name of the mysql table
        $file .= TAB.'protected $table = '.StringUtils::singleQuote($this->table).';'.LF.LF;

        // primary key defaults to "id"
        if ($this->primaryKey !== 'id') {
            $file .= TAB.'public $primaryKey = '.StringUtils::singleQuote($this->primaryKey).';'.LF.LF;
        }

        // timestamps defaults to true
        if (!$this->timestamps) {
            $file .= TAB.'public $timestamps = '.var_export($this->timestamps, true).';'.LF.LF;
        }

        // incrementing defaults to true
        if (!$this->incrementing) {
            $file .= TAB.'public $incrementing = '.var_export($this->incrementing, true).';'.LF.LF;
        }

        // all date fields
        if (!empty($this->dates)) {
            $file .= TAB.'public function getDates()'.LF;
            $file .= TAB.'{'.LF;
            $file .= TAB.TAB.'return array('.StringUtils::implodeAndQuote(', ', $this->dates).');'.LF;
            $file .= TAB.'}'.LF.LF;
        }

        // most fields are considered as fillable
        $wrap = TAB.'protected $fillable = array('.StringUtils::implodeAndQuote(', ', $this->fillable).');'.LF.LF;
        $file .= wordwrap($wrap, ModelGenerator::$lineWrap, LF.TAB.TAB);

        // except for the hidden ones
        if (!empty($this->hidden)) {
            $file .= TAB.'protected $hidden = array('.StringUtils::implodeAndQuote(', ', $this->hidden).');'.LF.LF;
        }

        // add all relations
        $file .= rtrim($this->relations).LF; // remove one LF from end

        // close the class
        $file .= '}'.LF;

        $this->fileContents = $file;
    }
260644
public function create()
    {
        $instance = self::createBrand($this);
        $this->setId($instance->getId());
        return $instance;
    }
122608
protected function createModel()
    {
        $model = new ResetPasswordModel();
        $model->identityColumnName = $this->getLoginProvider()->getSettings()->identityColumnName;
        $model->resetPasswordEvent->attachHandler(function(){
            $this->initiateResetPassword();
        });

        return $model;
    }
735748
protected function createModel()
    {
        $model = $this->token->getModel();

        if ($model instanceof \Gems_Tracker_Model_StandardTokenModel) {
            $model->addEditTracking();

            if ($this->createData) {
                $model->applyInsertionFormatting();
            }
        }

        return $model;
    }
801384
public function create()
    {
        $instance = self::createCustomerGroup($this);
        $this->setId($instance->getId());
        return $instance;
    }
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;
    }
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,
			),
		));
	}
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;
    }
1213889
public function makeModel()
    {
        $this->options['name'] = $this->ask('Model Name (Example: Posts)');

        if ($this->confirm('Do you want to make a migration for this model?')) {
            $this->options['-m'] = '--migration';
        }

        if ($this->confirm('Do you want to make a controller for this model?')) {
            $this->options['-c'] = '--controller';

            if ($this->confirm('Is this controller a resourceful controller?')) {
                $this->options['-r'] = '--resource';
            }
        }
    }
236641
protected function createModel()
    {
        if ($this->model instanceof \Gems_Model_AppointmentModel) {
            $model = $this->model;
        } else {
            $model = $this->loader->getModels()->createAppointmentModel();
            $model->applyBrowseSettings();
        }

        $model->addColumn(new \Zend_Db_Expr("CONVERT(gap_admission_time, DATE)"), 'date_only');
        $model->set('date_only', 'formatFunction', array($this, 'formatDate'));
                // 'dateFormat', \Zend_Date::DAY_SHORT . ' ' . \Zend_Date::MONTH_NAME . ' ' . \Zend_Date::YEAR);
        $model->set('gap_admission_time', 'label', $this->_('Time'),
                'formatFunction', array($this, 'formatTime'));
                // 'dateFormat', 'HH:mm ' . \Zend_Date::WEEKDAY);

        $this->_dateStorageFormat = $model->get('gap_admission_time', 'storageFormat');
        // $this->_timeImg           = \MUtil_Html::create('img', array('src' => 'stopwatch.png', 'alt' => ''));

        $model->set('gr2o_patient_nr', 'label', $this->_('Respondent nr'));

        if ($this->respondent instanceof \Gems_Tracker_Respondent) {
            $model->addFilter(array(
                'gap_id_user' => $this->respondent->getId(),
                'gap_id_organization' => $this->respondent->getOrganizationId(),
                ));
        }

        return $model;
    }
1286658
protected function createModel()
    {
        if (! $this->model instanceof \Gems_Model_AppointmentModel) {
            $this->model = $this->loader->getModels()->createAppointmentModel();
            $this->model->applyBrowseSettings();
        }
        $this->model->addColumn(new \Zend_Db_Expr("CONVERT(gap_admission_time, DATE)"), 'date_only');
        $this->model->set('date_only', 'dateFormat',
                \Zend_Date::WEEKDAY . ' ' . \Zend_Date::DAY_SHORT . ' ' .
                \Zend_Date::MONTH_NAME . ' ' . \Zend_Date::YEAR,
                'storageFormat', 'YYYY-MM-DD'
                );
        $this->model->set('gap_admission_time', 'label', $this->_('Time'),
                'dateFormat', 'HH:mm');

        $this->model->set('gr2o_patient_nr', 'label', $this->_('Respondent nr'));

        \Gems_Model_RespondentModel::addNameToModel($this->model, $this->_('Name'));

        // \MUtil_Model::$verbose = true;
        return $this->model;
    }
1137424
protected function createModel()
    {
        if ($this->model instanceof \Gems_Model_StaffModel) {
            $model = $this->model;
        } else {
            $model = $this->loader->getModels()->getStaffModel();
            $model->applyBrowseSettings();
        }

        return $model;
    }