本文整理汇总了PHP中LSActiveRecord::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP LSActiveRecord::__construct方法的具体用法?PHP LSActiveRecord::__construct怎么用?PHP LSActiveRecord::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LSActiveRecord
的用法示例。
在下文中一共展示了LSActiveRecord::__construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $scenario
* @param int $iSurveyId
*/
public function __construct($iSurveyId = null, $scenario = 'insert')
{
if (!isset($iSurveyId)) {
$iSurveyId = Response::getLastSurveyId();
}
$this->surveyId = $iSurveyId;
parent::__construct($scenario);
}
示例2: __construct
/**
* @param string $scenario
* @param string $sTableName
*/
public function __construct($sTableName = null, $scenario = 'insert')
{
if (!isset($sTableName)) {
//Yii::trace('sTableName missing.');
throw new Exception('sTableName missing.');
}
$this->tableName = $sTableName;
parent::__construct($scenario);
}
示例3: __construct
/**
* See example usage at manual page: https://manual.limesurvey.org/Notifications#Examples
* @param array<string, mixed>|string|null $options If string then scenario
*/
public function __construct($options = null)
{
// Don't do anything if this is called from self::model()
if (is_string($options) || is_null($options)) {
parent::__construct($options);
// $options = scenario in this case
return;
} else {
// Why not Zoidberg? (\/) (°,,,°) (\/)
parent::__construct();
}
$options = $this->checkShortcuts($options);
$this->checkMandatoryFields($options, array('entity', 'entity_id', 'title', 'message'));
// Only allow 'survey' or 'user' as entity
if ($options['entity'] != 'survey' && $options['entity'] != 'user') {
throw new InvalidArgumentException('Invalid entity: ' . $options['entity']);
}
// Default to 'default' display class
if (!isset($options['display_class'])) {
$options['display_class'] = 'default';
}
// Default to 'log' notification importance
if (!isset($options['importance'])) {
$options['importance'] = self::NORMAL_IMPORTANCE;
}
// importance must be between 1 and 3
if ($options['importance'] < 1 && $options['importance'] > 3) {
throw new InvalidArgumentException('Invalid importance: ' . $options['importance']);
}
// Set everything up
$this->entity = $options['entity'];
$this->entity_id = $options['entity_id'];
$this->title = $options['title'];
$this->message = $options['message'];
$this->display_class = $options['display_class'];
$this->importance = $options['importance'];
$this->status = 'new';
$this->created = date('Y-m-d H:i:s', time());
$this->first_read = null;
}
示例4: __construct
public function __construct($scenario = 'insert')
{
list(, $this->dynamicId) = explode('_', get_class($this));
parent::__construct($scenario);
}