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

Use request->query->get() instead of request->get() #20

Closed
javiereguiluz opened this issue Jan 16, 2015 · 1 comment
Closed

Use request->query->get() instead of request->get() #20

javiereguiluz opened this issue Jan 16, 2015 · 1 comment
Labels

Comments

@javiereguiluz
Copy link
Collaborator

All the information in EasyAdmin is passed via query parameters. The best way to get the value of these parameters is:

$value = $request->query->get('name');

But most of the time, because I'm lazy, I use the following:

$value = $request->get('name');

This works right, but it's a bit slower and it's not strictly correct in our case (we pass data in the query string, then we shouldn't look for in other parts of the request).

This improvement was suggested by @stof in javiereguiluz@f08250a#commitcomment-9312420

@stof
Copy link

stof commented Jan 16, 2015

For POST requests, it is not exactly the same, because it would read the POST params too

javiereguiluz added a commit that referenced this issue Jan 17, 2015
This PR was merged into the master branch.

Discussion
----------

explicitly use query parameters, fixes #20

Commits
-------

816a93f explicitly use query parameters, fixes #20
javiereguiluz added a commit that referenced this issue Nov 6, 2015
…iereguiluz)

This PR was squashed before being merged into the master branch (closes #546).

Discussion
----------

Improved the way associations are displayed/handled

This fixes #539 and any other issue related to associations with entities that don't define the usual `__toString()` method. This is the new behavior:

1) Common case: backend displays a link to the "show" view of the target entity.

2) If the target entity is not managed by EasyAdmin, its string representation is displayed without a link.

3) If it's a collection of values, we show the count of elements (as we do now).

The main change is in how we determine the string representation of an associated value:

1) If the target entity has a `__toString()` method, we display `(string) $value`

2) If the target entity has a `getId()` method, we display `Name_of_class #ID` (e.g. `Category #20`)

3) Otherwise, we display the name of the class (e.g. `User`)

Commits
-------

7be2b8b Improved the way associations are displayed/handled
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