示例#1
0
 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;
 }
示例#2
0
 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     //        $array['blog_text'] = nl2br($array['blog_text']);
     if (strpos($array['payment_image'], 'uploads') !== false && strpos($array['payment_image'], 'http:') === false) {
         $array['payment_image'] = Yii::$app->request->getHostInfo() . $array['payment_image'];
     }
     return $array;
 }
示例#3
0
 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;
 }
示例#4
0
 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;
 }
示例#5
0
 /**
  * @param \yii\db\ActiveRecord $model
  */
 public function loadModel($model)
 {
     $this->attributes = $model->toArray();
 }
示例#6
0
 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));
 }
 /**
  * @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;
 }
示例#8
0
 public function toArray()
 {
     $array = parent::toArray();
     $array['pingicon'] = $this->pingicon;
     return $array;
 }
示例#9
0
 public function toArray(array $fields = array(), array $expand = array(), $recursive = true)
 {
     $array = parent::toArray($fields, $expand, $recursive);
     return $array;
 }
示例#10
0
 /**
  * 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;
 }
示例#11
0
 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;
 }
示例#12
0
 /**
  * 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;
     });
 }
示例#13
0
 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;
 }
 /**
  * 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);
         }
     }
 }
示例#15
0
 /**
  * (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);
 }