当前位置: 首页>>代码示例>>PHP>>正文


PHP Behavior::__get方法代码示例

本文整理汇总了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);
 }
开发者ID:sjaakp,项目名称:yii2-fuzzydate,代码行数:30,代码来源:FuzzyDateBehavior.php

示例2: __get

 public function __get($name)
 {
     if ($this->hasAttribute($name)) {
         return $this->getAttribute($name);
     }
     return parent::__get($name);
 }
开发者ID:GAMITG,项目名称:yz2-admin,代码行数:7,代码来源:DateRangeFilteringBehavior.php

示例3: __get

 public function __get($name)
 {
     if ($this->fileInputName == $name) {
         return $this->_file;
     }
     return parent::__get($name);
 }
开发者ID:zabachok,项目名称:yii2-hydra,代码行数:7,代码来源:FileInput.php

示例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);
 }
开发者ID:dlds,项目名称:yii2-rels,代码行数:11,代码来源:Behavior.php

示例5: __get

 public function __get($name)
 {
     if ($name == $this->getAttributeName()) {
         return $this->getRelation();
     }
     return parent::__get($name);
 }
开发者ID:NullRefExcep,项目名称:yii2-core,代码行数:7,代码来源:HasRelation.php

示例6: __get

 public function __get($name)
 {
     if ($this->hasLocalValue($name)) {
         return $this->getLocalValue($name);
     } else {
         return parent::__get($name);
     }
 }
开发者ID:omnilight,项目名称:yii2-phonenumbers,代码行数:8,代码来源:PhoneNumberBehavior.php

示例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);
     }
 }
开发者ID:mdmsoft,项目名称:yii2-client-tools,代码行数:11,代码来源:ClientBehavior.php

示例8: __get

 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (\Exception $e) {
         return $this->getAttribute($name);
     }
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:11,代码来源:EavBehavior.php

示例9: __get

 public function __get($param)
 {
     if (isset($this->attributes[$param])) {
         return $this->convertToLogical($this->owner->{$this->attributes[$param]});
     } else {
         return parent::__get($param);
     }
 }
开发者ID:sangkilsoft,项目名称:sangkilbiz-3,代码行数:8,代码来源:DateConverter.php

示例10: __get

 /**
  * @inheritdoc
  */
 public function __get($name)
 {
     if ($this->checkName($name)) {
         return $this->storage;
     } else {
         return parent::__get($name);
     }
 }
开发者ID:consultnn,项目名称:yii2-mongodb-embedded,代码行数:11,代码来源:AbstractEmbeddedBehavior.php

示例11: __get

 public function __get($name)
 {
     $rels = array_flip($this->directoryAttributes);
     if (isset($rels[$name])) {
         return $this->getDirectory($rels[$name]);
     }
     return parent::__get($name);
 }
开发者ID:tsyrya,项目名称:mybriop,代码行数:8,代码来源:DirectoryBehavior.php

示例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
 }
开发者ID:dkhru,项目名称:yii2-image-store,代码行数:8,代码来源:ImageBehavior.php

示例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);
 }
开发者ID:sangkilsoft,项目名称:sangkilbiz-3,代码行数:11,代码来源:PropertyBehavior.php

示例14: __get

 public function __get($name)
 {
     if ($this->_relation->canGetProperty($name)) {
         return $this->_relation->{$name};
     } else {
         return parent::__get($name);
     }
 }
开发者ID:mdmsoft,项目名称:yii2-ar-extended,代码行数:8,代码来源:ExtendedBehavior.php

示例15: __get

 public function __get($name)
 {
     if ($name == $this->propertyName) {
         return $this->getRelationIds();
     } else {
         return parent::__get($name);
     }
 }
开发者ID:omnilight,项目名称:yii2-many-many-relation,代码行数:8,代码来源:ManyManyRelationBehavior.php


注:本文中的yii\base\Behavior::__get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。