本文整理汇总了PHP中yii\base\Behavior::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP Behavior::__get方法的具体用法?PHP Behavior::__get怎么用?PHP Behavior::__get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Behavior
的用法示例。
在下文中一共展示了Behavior::__get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($name)
{
if (in_array($name, $this->attributes)) {
/* @var $owner Model; */
$owner = $this->owner;
$attr1 = $name . '1';
$attr2 = $name . '2';
$d1 = $owner->{$attr1};
$d2 = $owner->{$attr2};
if (!$d1 || !$d2) {
return null;
}
$date1 = DateTime::createFromFormat($this->format, $d1);
$date2 = DateTime::createFromFormat($this->format, $d2);
// if years are different, we take the first
$y1 = $date1->format('Y');
$r = ['y' => $y1];
$m1 = $date1->format('n');
if ($y1 == $date2->format('Y') && $m1 == $date2->format('n')) {
$r['m'] = $m1;
$d1 = $date1->format('j');
$r['d'] = $d1 == $date2->format('j') ? $d1 : null;
} else {
$r['m'] = null;
$r['d'] = null;
}
return $r;
}
return parent::__get($name);
}
示例2: __get
public function __get($name)
{
if ($this->hasAttribute($name)) {
return $this->getAttribute($name);
}
return parent::__get($name);
}
示例3: __get
public function __get($name)
{
if ($this->fileInputName == $name) {
return $this->_file;
}
return parent::__get($name);
}
示例4: __get
/**
* Returns the value of an object property.
* @param stirng $name the property name
*/
public function __get($name)
{
if (!in_array($name, $this->attrs)) {
return parent::__get($name);
}
return $this->getInterpretation($name);
}
示例5: __get
public function __get($name)
{
if ($name == $this->getAttributeName()) {
return $this->getRelation();
}
return parent::__get($name);
}
示例6: __get
public function __get($name)
{
if ($this->hasLocalValue($name)) {
return $this->getLocalValue($name);
} else {
return parent::__get($name);
}
}
示例7: __get
/**
* @inheritdoc
*/
public function __get($name)
{
if (stripos($name, 'client') === 0) {
return strcasecmp($name, 'clientId') == 0 ? $this->_clientId : $this->getClientProperty(strtolower($name));
} else {
return parent::__get($name);
}
}
示例8: __get
/**
* @inheritdoc
*/
public function __get($name)
{
try {
return parent::__get($name);
} catch (\Exception $e) {
return $this->getAttribute($name);
}
}
示例9: __get
public function __get($param)
{
if (isset($this->attributes[$param])) {
return $this->convertToLogical($this->owner->{$this->attributes[$param]});
} else {
return parent::__get($param);
}
}
示例10: __get
/**
* @inheritdoc
*/
public function __get($name)
{
if ($this->checkName($name)) {
return $this->storage;
} else {
return parent::__get($name);
}
}
示例11: __get
public function __get($name)
{
$rels = array_flip($this->directoryAttributes);
if (isset($rels[$name])) {
return $this->getDirectory($rels[$name]);
}
return parent::__get($name);
}
示例12: __get
public function __get($name)
{
if (preg_match('/^(.+)(_image)$/', $name, $m) && isset($m[1]) && isset($this->imageFields[$m[1]])) {
return $this->getImage($m[1]);
}
return parent::__get($name);
// TODO: Change the autogenerated stub
}
示例13: __get
/**
* @inheritdoc
*/
public function __get($name)
{
$this->initProperties();
if (isset($this->_properties[$name]) || array_key_exists($name, $this->_properties)) {
return $this->_properties[$name];
}
return parent::__get($name);
}
示例14: __get
public function __get($name)
{
if ($this->_relation->canGetProperty($name)) {
return $this->_relation->{$name};
} else {
return parent::__get($name);
}
}
示例15: __get
public function __get($name)
{
if ($name == $this->propertyName) {
return $this->getRelationIds();
} else {
return parent::__get($name);
}
}