Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Add Annotation Support #35

Open
cryptiklemur opened this issue Jun 7, 2014 · 15 comments
Open

Add Annotation Support #35

cryptiklemur opened this issue Jun 7, 2014 · 15 comments

Comments

@cryptiklemur
Copy link

Would be really cool to specify breadcrumbs via annotations :)

Idk if this makes sense to you, but a discussion would be nice

@richsage
Copy link
Contributor

richsage commented Sep 3, 2014

Sorry for the late reply - I'd definitely be up for that :-)

@cryptiklemur
Copy link
Author

heh, is this your subtle way of asking for a PR?

@richsage
Copy link
Contributor

richsage commented Sep 8, 2014

PRs are always welcome :-)

@MatissJanis
Copy link

Just a heads up - annotation support would be really cool, if someone is up to building it. ;)

@soullivaneuh
Copy link
Contributor

👍 I could take a look if I get some time.

@soullivaneuh
Copy link
Contributor

@aequasi @richsage @MatissJanis Have you annotation configuration samples of what you are wondering?

@bocharsky-bw
Copy link
Contributor

@soullivaneuh Sounds great, I think it will be nice to have such behaviour like:

use WhiteOctober\BreadcrumbsBundle\Annotation\BreadcrumbsAnnotation as Breadcrumb;

/**
 * @Breadcrumb\Item('Home', url='/')
 * @Breadcrumb\RouteItem('Blog', route={name='post'})
 */
class PostController() {
    /**
     * @Breadcrumb\RouteItem('{post.name}', route={name='post_show', parameters={'id': '{post.id}'}})
     */
    public function showAction(Post $post)
    {
        // action code here...
    }
}

in result we will have:

Home > Blog > The post name

What do you think?

@cryptiklemur
Copy link
Author

A single annotation would probably be easier

/**
 * @Breadcrumb('Home', url='/')
 * @Breadcrumb('Blog', route={name='post'})
 */
class PostController() {
    /**
     * @Breadcrumb('{post.name}', route={name='post_show', parameters={'id': '{post.id}'}})
     */
    public function showAction(Post $post)
    {
        // action code here...
    }
}

@richsage
Copy link
Contributor

I'd probably prefer @aequasi's version - a single annotation. Unless it gets a bit too unwieldy with large amounts of configuration options in the annotation. @bocharsky-bw what were your thoughts behind separate ones (aside from the URL and route differences)?

@bocharsky-bw
Copy link
Contributor

@richsage I have maintained the current application architecture only. We have addItem and addRouteItem methods now. If we do a single annotation for it, we also could to prioritize url or route if user add them both inadvertently.

I think a single annotation is a bit overload, but @aequasi is right, it will be more easy to use and most probably it will be better in this case.

@soullivaneuh
Copy link
Contributor

Both approach has good argument. I prefer @aequasi too. I'll try it and see if it's possible.

@soullivaneuh
Copy link
Contributor

Using expression language may help. Dunno, just a remember note.

http://symfony.com/doc/current/components/expression_language/introduction.html

@bocharsky-bw
Copy link
Contributor

@soullivaneuh I think symfony's expression language will be useful in this case 👍
Even more it provides by Symfony SE out-of-the-box.

@rvanlaak
Copy link

rvanlaak commented Oct 7, 2015

Found the Abhoryo/APYBreadcrumbTrailBundle having Annotation support, maybe @Abhoryo can tell or that bundle still is maintained? It does exactly what #35 (comment) does suggest.

Especially the integration with @ParamConverter is really awesome! https://github.com/Abhoryo/APYBreadcrumbTrailBundle/blob/master/Resources/doc/annotation_configuration.md#title-using-paramconverter

@rzymianin11
Copy link

appreciate to do this! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants