當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ActiveRecord::toArray方法代碼示例

本文整理匯總了PHP中yii\db\ActiveRecord::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP ActiveRecord::toArray方法的具體用法?PHP ActiveRecord::toArray怎麽用?PHP ActiveRecord::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\db\ActiveRecord的用法示例。


在下文中一共展示了ActiveRecord::toArray方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: toArray

 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     if (strpos($array['photo_base64'], 'uploads') !== false && strpos($array['photo_base64'], 'http:') === false) {
         $array['photo_base64'] = Yii::$app->request->getHostInfo() . $array['photo_base64'];
     }
     return $array;
 }
開發者ID:pylypen,項目名稱:api-side,代碼行數:8,代碼來源:Studio.php

示例2: toArray

 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     $array['likes'] = $this->getLikes()->all();
     $array['created'] = date("d M Y", $this->created_at);
     if (strpos($array['image_base64'], 'uploads') !== false && strpos($array['image_base64'], 'http:') === false) {
         $array['image_base64'] = Yii::$app->request->getHostInfo() . $array['image_base64'];
     }
     return $array;
 }
開發者ID:pylypen,項目名稱:api-side,代碼行數:10,代碼來源:Gallery.php

示例3: toArray

 public function toArray(array $fields = [], array $expand = [], $recursive = true)
 {
     $data = parent::toArray($fields, $expand, $recursive);
     $data['id'] = strtoupper(bin2hex($data['id']));
     foreach ($this->uuidRelations as $relationKey) {
         if (isset($data[$relationKey])) {
             $data[$relationKey] = strtoupper(bin2hex($data[$relationKey]));
         }
     }
     return $data;
 }
開發者ID:wartron,項目名稱:yii2-uuid,代碼行數:11,代碼來源:ActiveRecord.php

示例4: loadModel

 /**
  * @param \yii\db\ActiveRecord $model
  */
 public function loadModel($model)
 {
     $this->attributes = $model->toArray();
 }
開發者ID:gromver,項目名稱:yii2-platform,代碼行數:7,代碼來源:ActiveDocument.php

示例5: toArray

 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     unset($array['user_auth_key']);
     unset($array['user_password_hash']);
     unset($array['user_password_reset_token']);
     unset($array['stream_userid']);
     unset($array['stream_username']);
     unset($array['stream_password']);
     return array_merge($array, $this->getUserInfo($this->id));
 }
開發者ID:pylypen,項目名稱:admin-side,代碼行數:11,代碼來源:Users.php

示例6: toArray

 /**
  * @param array $fields
  * @param array $expand
  * @param bool|true $recursive
  * @return array
  */
 public function toArray(array $fields = [], array $expand = [], $recursive = true)
 {
     if (empty($fields)) {
         $fields = $this->fields();
     }
     $fields = array_diff($fields, $this->hidden);
     $data = parent::toArray(ArrayHelper::valuesToUnderscore($fields), $expand, $recursive);
     ArrayHelper::keysToCamelCase($data);
     return $data;
 }
開發者ID:JiltImageBoard,項目名稱:jilt-backend,代碼行數:16,代碼來源:ARExtended.php

示例7: toArray

 public function toArray()
 {
     $array = parent::toArray();
     $array['pingicon'] = $this->pingicon;
     return $array;
 }
開發者ID:RyosukeMurai,項目名稱:TokyoSearch,代碼行數:6,代碼來源:Instagram.php

示例8: toArray

 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     return $array;
 }
開發者ID:pylypen,項目名稱:admin-side,代碼行數:5,代碼來源:Classes.php

示例9: toArray

 /**
  * Adds _label field to serialized array if model has a __toString() method.
  *
  * @inheritdoc
  */
 public function toArray(array $fields = [], array $expand = [], $recursive = true)
 {
     $data = parent::toArray($fields, $expand, $recursive);
     if (method_exists($this, '__toString')) {
         $data['_label'] = $this->__toString();
     }
     return $data;
 }
開發者ID:netis-pl,項目名稱:yii2-crud,代碼行數:13,代碼來源:ActiveRecord.php

示例10: toArray

 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     unset($array['user_auth_key']);
     unset($array['user_password_hash']);
     unset($array['user_password_reset_token']);
     return $array;
 }
開發者ID:pylypen,項目名稱:admin-side,代碼行數:8,代碼來源:User.php

示例11: toArray

 /**
  * Redefine standard toArray method for avoiding showing atributes with null value
  * null attributes needed for exended view of many-to-many relation
  * @param array $fields
  * @param array $expand
  * @param bool|true $recursive
  * @return array
  */
 public function toArray(array $fields = [], array $expand = [], $recursive = true)
 {
     return array_filter(parent::toArray($fields, $expand, $recursive), function ($val) {
         return is_null($val) ? false : true;
     });
 }
開發者ID:AndriyK,項目名稱:team,代碼行數:14,代碼來源:AppActiveRecord.php

示例12: toArray

 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     if (!empty($array['students'])) {
         foreach ($array['students'] as $k => $v) {
             if (strpos($array['students'][$k]['payment_image'], 'uploads') !== false && strpos($array['students'][$k]['payment_image'], 'http:') === false) {
                 $array['students'][$k]['payment_image'] = Yii::$app->request->getHostInfo() . $array['students'][$k]['payment_image'];
             }
         }
     }
     return $array;
 }
開發者ID:pylypen,項目名稱:api-side,代碼行數:12,代碼來源:Classes.php

示例13: addRowToMap

 /**
  * Add a one row to identity map
  * @param ActiveRecord | array $row
  */
 public static function addRowToMap($row)
 {
     $id = static::getIdAttribute();
     if ($row !== null && isset($row[$id])) {
         self::$identityMap[$row[$id]] = $row instanceof ActiveRecord ? $row->toArray() : $row;
         $maxSize = static::getIdentityMapMaxSize();
         foreach (static::getUniqueAttributes() as $uniqueAttribute) {
             self::$uniqueAttributeToId[$uniqueAttribute][$row[$uniqueAttribute]] = $row[$id];
         }
         if ($maxSize !== -1 && count(self::$identityMap) > $maxSize) {
             array_shift(self::$identityMap);
         }
     }
 }
開發者ID:yiister,項目名稱:yii2-mappable-ar,代碼行數:18,代碼來源:ActiveRecordTrait.php

示例14: toArray

 /**
  * (non-PHPdoc)
  * @see \yii\base\Model::toArray()
  */
 public function toArray(array $fields = [], array $expand = [], $recursive = true)
 {
     if ($this->getIsNewRecord() && $this->applyDefaults && !$this->defaultsApplied) {
         $this->applyDefaults(false);
     }
     $recursive = false;
     return parent::toArray($fields, $expand, $recursive);
 }
開發者ID:fangface,項目名稱:yii2-concord,代碼行數:12,代碼來源:ActiveRecord.php


注:本文中的yii\db\ActiveRecord::toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。