本文整理汇总了PHP中yii\db\BaseActiveRecord::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseActiveRecord::getAttribute方法的具体用法?PHP BaseActiveRecord::getAttribute怎么用?PHP BaseActiveRecord::getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\db\BaseActiveRecord
的用法示例。
在下文中一共展示了BaseActiveRecord::getAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNextStatus
/**
* Returns the status string of the next valid status from the list of transitions
*
* @param BaseActiveRecord|SimpleWorkflowBehavior $model
* @return string
*/
public static function getNextStatus($model)
{
$currentStatus = $model->getAttribute('status');
$statusList = $model->getWorkflowSource()->getAllStatuses($model->getWorkflow()->getId());
$transitions = array_keys(WorkflowHelper::getNextStatusListData($this->owner));
$started = false;
foreach ($statusList as $status) {
$status_id = $status->getId();
if ($started) {
if (in_array($status_id, $transitions) && static::isValidNextStatus($model, $status_id)) {
return $status_id;
}
}
if ($status_id == $currentStatus) {
$started = true;
}
}
return $currentStatus;
}
示例2: thumbnail
/**
* @param BaseActiveRecord $owner
* @param $attribute
* @param $dimension
* @param bool $absoluteUrl
*
* @return mixed|null|string
*/
public function thumbnail($owner, $attribute, $dimension, $absoluteUrl = true)
{
$value = $owner->getAttribute($attribute);
if ((new UrlValidator())->validate($value)) {
return $value;
}
if ($value && file_exists($value)) {
return Url::to('@web/' . (new Thumbnailer(['imagePath' => $value]))->generate($dimension), $absoluteUrl);
}
if ($this->placeholder) {
list($width, $height) = Utils::getDimension($dimension);
return call_user_func([$this->placeholder, 'getImage'], $width, $height);
}
return null;
}