Skip to content

Explaining controllers as viable alternative #13554

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

Merged
merged 8 commits into from
Aug 3, 2020

Conversation

ThomasLandauer
Copy link
Contributor

See #13406 (comment)

Please wrap it in a "caution" box, or whatever you think is appropriate.

I'm unsure about how much context of the controller should be shown in the code, since the entire controller is only shown later. If you think it's too confusing now, I'd suggest to show the controller as "skeleton" above this note.

Copy link
Member

@wouterj wouterj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ThomasLandauer! I've added a commit to this PR to transform it into a tip & slightly reworded the message. Please let me know if you disagree with any changes

@ThomasLandauer
Copy link
Contributor Author

slightly reworded

lol

I re-added the first sentence (plus an additional "instead"). We need to emphasize that this is not just some "introduction" to voters, but rather a completely different approach. And the first sentence somehow tries to explain that the following example isn't a good real-world example for the usage of voters. I thought about adding something like "for simplicity's sake", but couldn't find a good solution...

@wouterj
Copy link
Member

wouterj commented Apr 17, 2020

And the first sentence somehow tries to explain that the following example isn't a good real-world example for the usage of voters.

I think it is. I wouldn't call the permission logic in this example "simple"/"basic" anymore (75+ lines of code). I don't think the first sentence adds much to the tip (it's really a separate tip) and I wanted to keep it as small as possible (long side blocks are often distracting), that's why I removed it.

Co-Authored-By: Antoine Makdessi <antoine.makdessi@agriconomie.com>
@ThomasLandauer
Copy link
Contributor Author

What I'm trying to say: The following example is "basic" in the sense that it fulfills exactly our "new" criteria for doing it differently:

If you don't reuse permissions or the rules are basic, you instead might want to

There's no reuse, and the rules are simple. So my full message would read:

If your app is exactly like ours here, don't use voters. We chose this unrealistically simplified example in order to be able to show you how voters work in just 75+ lines, not 200+.

Don't know how to get this across in just one short sentence ;-)

Trying to merge the suggestions of 4 people ;-)

What's really odd is that on this dedicated voters page, the reader is referred to someplace else for more info on voters ;-)

> Take a look at the authorization article for an even deeper understanding on voters.

So in the long run, these two should be merged - or at least the voters part integrated into this page.
throw $this->createAccessDeniedException();
}

In that sense, the following example used throughout this page is more like a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with adding the explanation above, but I do not agree with this sentence. The example used below IS a real-world use case. I suggest to remove this sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the second part - please take a look again :-)

@xabbuh
Copy link
Member

xabbuh commented Aug 3, 2020

Thank you @ThomasLandauer.

@xabbuh xabbuh merged commit b90336b into symfony:3.4 Aug 3, 2020
@ThomasLandauer
Copy link
Contributor Author

@xabbuh It looks like this wasn't up-migrated to 4.4, 5.1 etc:

Should I commit it to 4.4 too?

@xabbuh
Copy link
Member

xabbuh commented Aug 3, 2020

There were some conflicts when merging branches and I didn't have the time to look at them. Will probably manage to do so tomorrow.

xabbuh added a commit that referenced this pull request Aug 22, 2020
* 3.4:
  Adding `path`
  Fix term
  Change char to varchar type
  Use redirectToRoute
  [#13980] add annotation config example
  [Validator] Made the code sample more explicit with accepted values
  Update voters.rst
  Update voters.rst
  Update voters.rst
  Update security/voters.rst
  Update voters.rst
  [#13554] Slightly reworded the tip
  Update voters.rst
  Explaining controllers as viable alternative
xabbuh added a commit that referenced this pull request Aug 22, 2020
* 4.4:
  Adding `path`
  Fixing bad path for class PdoSessionHandler
  Fix typos: DNS -> DSN
  Fix term
  Fix logout on form login setup
  Change char to varchar type
  Use redirectToRoute
  [#13980] add annotation config example
  [Validator] Made the code sample more explicit with accepted values
  Update voters.rst
  Update voters.rst
  Update voters.rst
  Update security/voters.rst
  Update voters.rst
  [#13554] Slightly reworded the tip
  Update voters.rst
  Explaining controllers as viable alternative
xabbuh added a commit that referenced this pull request Aug 22, 2020
* 5.1: (21 commits)
  Adding `path`
  Fixing bad path for class PdoSessionHandler
  Fix package name modified post merge
  Fix typos: DNS -> DSN
  Fix term
  Fix inconsistent security docs
  Fix debug:container command
  Fix logout on form login setup
  Change char to varchar type
  Remove reference to non-existing fromBinary method
  Use redirectToRoute
  [#13980] add annotation config example
  [Validator] Made the code sample more explicit with accepted values
  Update voters.rst
  Update voters.rst
  Update voters.rst
  Update security/voters.rst
  Update voters.rst
  [#13554] Slightly reworded the tip
  Update voters.rst
  ...
@ThomasLandauer ThomasLandauer deleted the patch-15 branch September 27, 2021 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants