🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@xabbuh
Copy link
Collaborator

@xabbuh xabbuh commented Jul 24, 2018

In previous versions of EasyAdminBundle, the loading of annotated routes
was handled by the SensioFrameworkExtraBundle. With version 5.2 of the
SensioFrameworkExtraBundle their route annotation loader was deprecated
in favour of the implementation shipped with the Symfony FrameworkBundle
3.4+.

This commit provides a BC layer by wiring up the implementation of the
annotated route controller for older versions of the FrameworkBundle in
the same manner the Symfony core uses nowadays.

@xabbuh
Copy link
Collaborator Author

xabbuh commented Jul 24, 2018

see symfony/symfony#23044 for the PR that introduced this feature in Symfony

Copy link

@GuilhemN GuilhemN left a comment

Choose a reason for hiding this comment

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

👍, my only concern is that priorities need to be replaced (didn't exist prior 3.4)


// FrameworkBundle 3.4+ ships it own AnnotationClassLoader implementation, for older versions, we need to
// register our own implementation
if (!class_exists('Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader')) {

Choose a reason for hiding this comment

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

To avoid unreliable behavior (support of @Method not consistent for instance), I think this should be done in a compiler pass to be certain it's registered only if sensio's loader is not. Otherwise annotations support will be different based on the order bundles are registered.

if (!class_exists('Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader')) {
$container->register('easyadmin.routing.loader.annotation', 'EasyCorp\Bundle\EasyAdminBundle\Router\AnnotatedRouteControllerLoader')
->setPublic(false)
->addTag('routing.loader', array('priority' => -10))

Choose a reason for hiding this comment

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

Priorities didn't exist prior 3.4 :)

@xabbuh xabbuh force-pushed the route-annotation-loader-config branch 4 times, most recently from 842a67e to 6a77e30 Compare August 24, 2018 11:26
Copy link

@GuilhemN GuilhemN left a comment

Choose a reason for hiding this comment

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

👍 it should cover all cases even though it's a bit complicated

return;
}

if (!$container->has('routing.resolver')) {

Choose a reason for hiding this comment

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

We could also return earlier if sensio's annotation loader is registered (not strictly required but I think it'd be cleaner)

@javiereguiluz
Copy link
Collaborator

I'm afraid I'm a bit lost here. I don't fully understand the problem being solved here. But I trust @xabbuh completely, so please tell me if you think this is ready and I'll merge it. Thanks!

@xabbuh
Copy link
Collaborator Author

xabbuh commented Sep 19, 2018

@javiereguiluz I try to finish this until the end of this week.

@xabbuh xabbuh force-pushed the route-annotation-loader-config branch 2 times, most recently from 13b1fc9 to 83a1e71 Compare December 21, 2018 16:12
In previous versions of EasyAdminBundle, the loading of annotated routes
was handled by the SensioFrameworkExtraBundle. With version 5.2 of the
SensioFrameworkExtraBundle their route annotation loader was deprecated
in favour of the implementation shipped with the Symfony FrameworkBundle
3.4+.

This commit provides a BC layer by wiring up the implementation of the
annotated route controller for older versions of the FrameworkBundle in
the same manner the Symfony core uses nowadays.
@xabbuh xabbuh force-pushed the route-annotation-loader-config branch from 83a1e71 to 304e661 Compare December 21, 2018 16:21
@javiereguiluz
Copy link
Collaborator

Christian, I appreciate a lot your work here ... but I prefer to close this without merging. I want to stop merging things in 1.x branch so we can "close it" and focus on 2.x and the upcoming 3.x version. Thanks for understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants