Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning a plain array of items #371

Open
karlomikus opened this issue Apr 6, 2017 · 2 comments
Open

Returning a plain array of items #371

karlomikus opened this issue Apr 6, 2017 · 2 comments
Labels

Comments

@karlomikus
Copy link

I want to return an array of transformed tags like this (array of strings):

{
  "data": {
    "id": "196",
    "tags": {
      "data": [
        "jaidxg",
        "wfzhpu",
        "jwhmnczqpo"
      ]
    }
  }
}

In version 0.15.0 the following code, which returned only a string, worked fine:

public function transform(Tag $tag)
{
    return $tag->getName();
}

PR #273 Broke this functionality, is there any other way of transforming collection to just a plain array.

@Dadibom
Copy link

Dadibom commented May 23, 2017

As a workaround, you can make a transformer function that just returns whatever is passed into it. However if you don't return an array it will break. I would really like to be able to just return whatever value i want.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 4 weeks if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants