2017 © Pedro Peláez
 

symfony-bundle blaze-bundle

Write down your routing mapping at one place

image

happyr/blaze-bundle

Write down your routing mapping at one place

  • Wednesday, December 27, 2017
  • by Nyholm
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,156 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 12 % Grown

The README.md

Happyr BlazeBundle

Latest Version Build Status Code Coverage Quality Score Total Downloads, (*1)

This bundle lets you configure dynamic routes. A piece of code explains the benefit:, (*2)

// Generate the path /blog-post/{post_id}/comment/{comment_id}/edit
<a href="{{ path('edit_comment', {'comment_id':comment.id, 'post_id':comment.post.id}) }}">Click here</a>
<a href="{{ comment|blaze('edit') }}">Click here</a>

Installation

Step 1: Using Composer

$ composer require happyr/blaze-bundle

Step 2: Register the bundle

To register the bundles with your kernel:, (*3)

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new Happyr\BlazeBundle\HappyrBlazeBundle(),
    // ...
);

Step 3: Configure the bundle

``` yaml, (*4)

app/config/config.yml

happyr_blaze: objects: Acme\DemoBundle\Entity\Foo: edit: route: 'foo_edit' parameters: {id:'getId'} show: route: 'foo_show' parameters: {id:'getId'}, (*5)

Acme\DemoBundle\Entity\Bar:
  show:
    route: 'bar_show'
    parameters: {id:'getId'}

Acme\DemoBundle\Entity\Baz:
  anything:
    route: 'baz_show'
    parameters: {id:'getId', foo_id:'getFoo.getId'}

#if you need support for routes where the objects have no relation:
Acme\DemoBundle\Entity\FooBar:
  manage:
    route: 'foobar_manage'
    parameters: [{id: 'getId'}, {baz_id: 'getId', baz_name: 'getName'}, {bazbar_id: 'getSlug'}]
    complementaryObjects: ["Acme\DemoBundle\Entity\Baz", "Acme\DemoBundle\Entity\BazBar"]



## Usage ### Twig ```html {# foo is a Foo object #} <a href="{{ foo|blaze('show') }}">Show Foo</a> {# baz is a Baz object #} <a href="{{ baz|blaze('anything') }}">Show Baz</a> {# and the multiple objects .. #} <a href="{{ [foobar,baz,bazbar]|blaze('manage') }}">Show Baz</a>

PHP

use Happyr\BlazeBundle\Service\BlazeManagerInterface;

class MyController
{
    private $blaze;
    public function __construct(BlazeManagerInterface $blaze) {
        $this->blaze = $blaze;
    }

    public function SomeAction() {
        $blaze = $this->get(BlazeManagerInterface::class);

        $showUrl = $blaze->getPath($foo, 'show');
        $manageUrl = $blaze->getPath($foobar, 'show', array($baz, $bazbar));

        // ...
    }
}

The Versions

23/01 2017
23/12 2015

0.2.0

0.2.0.0 http://developer.happyr.com/symfony2-bundles/happyr-blaze-bundle

Write down your routing mapping at one place

  Sources   Download

MIT

The Requires

 

The Development Requires

route routing dynamic blaze

09/11 2013

0.1.1

0.1.1.0 http://developer.happyr.se/symfony2-bundles/happyr-blaze-bundle

Write down your routing mapping at one place

  Sources   Download

MIT

The Requires

 

The Development Requires

routing

11/10 2013

0.1.0

0.1.0.0 http://developer.happyr.se/symfony2-bundles/happyr-blaze-bundle

Write down your routing mapping at one place

  Sources   Download

MIT

The Requires

 

The Development Requires

routing