本文整理匯總了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;
}