Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Document the AbstractController#7657

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 3 commits intosymfony:masterfromGuilhemN:CONTROLLER
May 2, 2017

Conversation

@GuilhemN
Copy link
Contributor

Documentsymfony/symfony#18193.
I'm not sure it should be merged right now though as it's an experimental feature.

\cc@dunglas

@HeahDude
Copy link
Contributor

@GuilhemN Would you like to document the abstract controller introduced insymfony/symfony#22157 instead? Thanks!

@GuilhemN
Copy link
ContributorAuthor

GuilhemN commentedMar 26, 2017
edited
Loading

@HeahDude oh that's already merged, I didn't expect it to be so quick. I'll make the changes :)

HeahDude reacted with thumbs up emoji

@GuilhemNGuilhemN changed the title[FrameworkBundle] Document the ControllerTrait[FrameworkBundle] Document the AbstractControllerMar 26, 2017
@GuilhemN
Copy link
ContributorAuthor

Updated to document theAbstractController instead.

ping@nicolas-grekas

@HeahDude
Copy link
Contributor

Closes#7705.

usually pretty easy and the base `Controller class source code`_ is a great
source on how to perform many common tasks.
In case you don't want to inject the container in your controllers,
it's possible to get ride of controller shortcut methods: you can interact

Choose a reason for hiding this comment

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

to get rid of (no "e")

# app/config/services.yml
services:
_instanceof:
Symfony\Bundle\FrameworkBundle\Controller\AbstractController:

Choose a reason for hiding this comment

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

this block is not needed, let's remove it from the doc

Choose a reason for hiding this comment

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

In fact, there is no config to do at all, an AbstractController doesn't need to be a service at all

Copy link
ContributorAuthor

@GuilhemNGuilhemNMar 26, 2017
edited
Loading

Choose a reason for hiding this comment

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

Do you think it should be documented in a different section then?

Imo its main usage is using controllers as a service and having access to the shortcuts.

Using the controller shortcuts
------------------------------

To use the traditional controller shortcuts, you can use the
Copy link
Member

@nicolas-grekasnicolas-grekasMar 26, 2017
edited
Loading

Choose a reason for hiding this comment

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

this paragraph is a bit strange to me, it doesn't really teach enough to the reader imho.
eg

if you prefer explicit injection (you can't access the container)

"why would I prefer explicit injection? esp when the words in the brackets suggest that this is less powerful, so let's just to the previousController." Which then raises "why did they tell me about this? do I miss anything?" leading to confusion.

my 2cts :)

@GuilhemN
Copy link
ContributorAuthor

Updated to document theAbstractController in thecontroller.rst file to not limit its use to controllers as services.


The Base ControllerClass & Services
------------------------------------
The Base ControllerClasses & Services
Copy link
Member

Choose a reason for hiding this comment

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

we should add a label for the old headline to not break any deep links

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Fixed, I'm not 100% sure this is how it works though.

brings in even *more* services.

When extending the basecontroller class, you can access any Symfony service
When extending the base``Controller`` class, you can access any Symfony service
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we're missing pros of using the new AbstractController, dependencies are explicit either in a constructor or in action signatures, but the controller needs to be configured to get injection.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Do you mean we have to tell that the controller has to be configured as a service ? I updated the text to reflect that.

Copy link
Contributor

@HeahDudeHeahDudeApr 7, 2017
edited
Loading

Choose a reason for hiding this comment

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

Hmm it seems I got confused, reading@nicolas-grekas's comment above:

In fact, there is no config to do at all, an AbstractController doesn't need to be a service at all

The injection in this case is relying on an argument value resolver, so the controller does not need any configuration indeed.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I just said is wrong, the getters has nothing to do with action injections, so I don't get it, this must be configured somehow, it's just already done by the bundle.

@weaverryanweaverryan merged commit4ac5da7 intosymfony:masterMay 2, 2017
weaverryan added a commit that referenced this pull requestMay 2, 2017
…hemN)This PR was squashed before being merged into the master branch (closes#7657).Discussion----------[FrameworkBundle] Document the AbstractControllerDocumentsymfony/symfony#18193.I'm not sure it should be merged right now though as it's an experimental feature.\cc@dunglasCommits-------4ac5da7 Fix88a4806 Fixcf2ae91 [FrameworkBundle] Document the AbstractController
@weaverryan
Copy link
Member

Thanks@GuilhemN! I'll merge this into my#7807 :)

The Base Controller Class & Services
------------------------------------
.. _anchor-name:
:ref:`TheBaseControllerClasses&Services<the-base-controller-class-services>`
Copy link
Member

Choose a reason for hiding this comment

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

I'm not familiar with thisanchor-name thing - were you trying to make sure the old anchor still worked? If so,#7867 for an example. I'll update this in my PR

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes that wasa request from @xabbuh.
Thanks for the example, I never did that before and obviously didn't do it well by randomly trying :)

@GuilhemNGuilhemN deleted the CONTROLLER branchMay 2, 2017 15:15
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@weaverryanweaverryanweaverryan left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@xabbuhxabbuhxabbuh left review comments

+1 more reviewer

@HeahDudeHeahDudeHeahDude left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@GuilhemN@HeahDude@weaverryan@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp