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

Add autowire for resource Controllers #255

Merged
merged 4 commits into from
Jan 21, 2021

Conversation

AdamKasp
Copy link
Contributor

Q A
Bug fix? no?
New feature? yes
BC breaks? no
Deprecations? no
License MIT

@AdamKasp AdamKasp requested a review from a team as a code owner January 14, 2021 08:47
@AdamKasp AdamKasp changed the title [WIP] add autowire for resource Controllers Add autowire for resource Controllers Jan 15, 2021
@AdamKasp AdamKasp force-pushed the fix-controller-registration branch 16 times, most recently from a39e191 to 38465a2 Compare January 19, 2021 12:17
@lchrusciel lchrusciel force-pushed the fix-controller-registration branch from 11fbc28 to 994666a Compare January 19, 2021 16:08
Copy link
Member

@lchrusciel lchrusciel left a comment

Choose a reason for hiding this comment

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

lint:container command should be added to pipeline

@loic425
Copy link
Member

loic425 commented Jan 19, 2021

@pamil pamil force-pushed the fix-controller-registration branch from 994666a to a5b83f0 Compare January 19, 2021 17:16
@AdamKasp AdamKasp force-pushed the fix-controller-registration branch from 937e0e5 to adbbfc3 Compare January 20, 2021 07:49
@lchrusciel
Copy link
Member

Hey Loic,
thanks for the advice. I've totally forgotten about your fix and it was pretty good. However, it works only when the people will customize it in their end application, and from what I've checked lint:container command will still complain about resource controllers:
image

In addition, with this fix, you will be able to use the FQCN of controllers in routing:

app_book_sortable_index:
    path: /sortable-books/
    methods: [GET]
    defaults:
        _controller: \App\Controller\BookController:indexAction
        _sylius:
            sortable: true

@AdamKasp can you add config to your PR? It should be changed in src/Bundle/test/config/routes.yaml, line 15th to be exact.

@loic425
Copy link
Member

loic425 commented Jan 20, 2021

Hey Loic,
thanks for the advice. I've totally forgotten about your fix and it was pretty good. However, it works only when the people will customize it in their end application, [...]

@lchrusciel Yes, I just wanted you have this little hook on your mind :)

@AdamKasp AdamKasp force-pushed the fix-controller-registration branch from adbbfc3 to c6e7f61 Compare January 20, 2021 10:09
@AdamKasp AdamKasp force-pushed the fix-controller-registration branch 3 times, most recently from 1eb7982 to bce1f68 Compare January 20, 2021 10:36
@Zales0123 Zales0123 added the Feature New feature proposals. label Jan 20, 2021
pamil
pamil previously requested changes Jan 20, 2021
docs/create_resource.md Outdated Show resolved Hide resolved
if ($controllerFQCN !== ResourceController::class) {
$definition = $container->getDefinition($metadata->getServiceId('controller'));

// TODO: Change to alias definition after bumping to > Symfony 5.2
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we use aliases in Symfony 4.4?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we need here public aliases which will be provided in Symfony 5.2

Copy link
Contributor

Choose a reason for hiding this comment

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

It's available in Symfony 5.1 as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we change the comment? Or maybe put some if to find out if Symfony 5.1 is installed and then using an alias instead of copied definition?

@AdamKasp AdamKasp force-pushed the fix-controller-registration branch 2 times, most recently from 482e667 to 34526d7 Compare January 20, 2021 14:57
@lchrusciel lchrusciel dismissed pamil’s stale review January 20, 2021 15:08

Changes have been applied

@AdamKasp AdamKasp force-pushed the fix-controller-registration branch from 34526d7 to 24ce5fb Compare January 20, 2021 18:41
@GSadee GSadee merged commit e2682a0 into Sylius:master Jan 21, 2021
@GSadee
Copy link
Member

GSadee commented Jan 21, 2021

Thanks, Adam! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants