本文整理汇总了PHP中LSActiveRecord::model方法的典型用法代码示例。如果您正苦于以下问题:PHP LSActiveRecord::model方法的具体用法?PHP LSActiveRecord::model怎么用?PHP LSActiveRecord::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LSActiveRecord
的用法示例。
在下文中一共展示了LSActiveRecord::model方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: model
/**
* Returns the static model of ParticipantAttributeName table
*
* @static
* @access public
* @param string $class
* @return ParticipantAttributeName
*/
public static function model($class = __CLASS__)
{
$model = parent::model($class);
$keys = $model->tableSchema->primaryKey;
if (is_array($keys) && count($keys) == 2) {
// Fix the primary key, needed for PgSQL http://bugs.limesurvey.org/view.php?id=6707
// First load the helper
Yii::app()->loadHelper('update/updatedb');
$dbType = setsDBDriverName();
setVarchar($dbType);
$table = 'participant_attribute_names';
if ($dbType == 'mysql') {
// Only for mysql first remove auto increment
alterColumn($model->tableName(), $model->primaryKey(), $model->tableSchema->getColumn($model->primaryKey())->dbType, false);
}
dropPrimaryKey($table);
addPrimaryKey($table, (array) $model->primaryKey());
if ($dbType == 'mysql') {
// Add back auto increment
alterColumn($model->tableName(), $model->primaryKey(), Yii::app()->getConfig('autoincrement'));
}
// Refresh all schema data now just to make sure
Yii::app()->db->schema->refresh();
$model->refreshMetaData();
}
return $model;
}
示例2: model
/**
* Returns the static model of Settings table
*
* @static
* @access public
* @param int $surveyid
* @return Tokens_dynamic
*/
public static function model($sid = null)
{
if (!is_null($sid)) {
self::sid($sid);
}
return parent::model(__CLASS__);
}
示例3: model
/**
*
* @param type $className
* @return Dynamic
*/
public static function model($className = null)
{
if (!isset($className)) {
$className = get_called_class();
} elseif (is_numeric($className)) {
$className = get_called_class() . '_' . $className;
}
return parent::model($className);
}
示例4: model
/**
* Returns the static model of Settings table
*
* @static
* @access public
* @param int $surveyid
* @return Tokens_dynamic
*/
public static function model($sid = NULL)
{
$refresh = false;
if (!is_null($sid)) {
self::sid($sid);
$refresh = true;
}
$model = parent::model(__CLASS__);
//We need to refresh if we changed sid
if ($refresh === true) {
$model->refreshMetaData();
}
return $model;
}
示例5: model
/**
* Returns the static model of Settings table
*
* @static
* @access public
* @param string $class
* @return Answer
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
}