opifer/redirect-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Opifer Redirect Bundle

Installs: 4 704

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 2

Type:symfony-bundle

0.1.4 2016-01-08 09:24 UTC

This package is auto-updated.

Last update: 2020-08-28 14:06:28 UTC


README

Build Status

RedirectBundle

Symfony Bundle to handle dynamic page redirects. Based on the KunstmaanRedirectBundle, but refactored to require less dependencies and ease the overriding of functionality.

Installation

Add OpiferRedirectBundle to your composer.json

$ composer require opifer/redirect-bundle "~0.1"

And enable the bundle in app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Opifer\RedirectBundle\OpiferRedirectBundle(),
    ];
}

Add the Redirect entity

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Opifer\RedirectBundle\Model\Redirect as BaseRedirect;

/**
 * @ORM\Entity()
 * @ORM\Table(name="redirect")
 */
class Redirect extends BaseRedirect
{
    
}

And define it in your config.yml:

opifer_redirect:
    redirect:
        class: AppBundle\Entity\Redirect

Optionally add the routing for the RedirectController:

opifer_redirect:
    resource: "@OpiferContentBundle/Resources/config/routing.yml"
    prefix: /admin/redirects

Add the RedirectRouter to your chain router. For example, when you're using CMFRoutingBundle, add the opifer.redirect.redirect_router to the cmf_routing config.

cmf_routing:
    chain:
        routers_by_id:
            opifer.redirect.redirect_router: 200
            router.default: 100

Configuration reference

opifer_redirect:
    redirect:
        class: ~
        manager: opifer.redirect.redirect_manager.default
        view:
            index: OpiferRedirectBundle:Redirect:index.html.twig
            create: OpiferRedirectBundle:Redirect:create.html.twig
            edit: OpiferRedirectBundle:Redirect:edit.html.twig