luya\helpers\ArrayHelper::toObject PHP Method

toObject() public static method

Create an object from an array.
public static toObject ( array $array ) : object
$array array
return object
    public static function toObject(array $array)
    {
        return json_decode(json_encode($array), false);
    }

Usage Example

Ejemplo n.º 1
0
 public function get($imageId)
 {
     // get the real full image path to display this file.
     $data = StorageImage::find()->where(['id' => $imageId])->with('file')->one();
     if (!$data || !isset($data->file)) {
         return false;
     }
     $fileName = implode([$data->filter_id, $data->file->name_new_compound], '_');
     return ArrayHelper::toObject(['filter_id' => $data->filter_id, 'file_id' => $data->file_id, 'file_is_deleted' => $data->file->is_deleted, 'image_id' => $data->id, 'file_source' => $data->file->name_new_compound, 'image_source' => $fileName, 'source' => \yii::$app->storage->httpDir . $fileName]);
 }
All Usage Examples Of luya\helpers\ArrayHelper::toObject