當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。