DbRoutingBundle icon indicating copy to clipboard operation
DbRoutingBundle copied to clipboard

How to use this bundle?

Open burn2delete opened this issue 14 years ago • 1 comments

How to implement this bundle is not clearly defined.

Could you provide an example of what the database entries would look like?

burn2delete avatar Feb 18 '11 19:02 burn2delete

Your question is a long time ago but maybe some other have the same question.

After you followed the steps in the readme file you need to create a new Entity, if you want to use the default config you need to create an Entity Page in the CmsBundle if not change the resource parameter in your routing.yml

Your new Entity could look like this:

<?php

namespace CmsBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="pages")
 */
class Page
{
    /**
     * @var int
     *
     * @ORM\Id
     * @ORM\Column(name="id", type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=1000)
     */
    private $title;

    /**
     * @ORM\Column(type="string", length=1000)
     */
    private $slug;

    /**
     * @ORM\Column(type="string", length=1000)
     */
    private $controller;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    public function getTitle()
    {
        return $this->title;
    }

    public function getSlug()
    {
        return $this->slug;
    }

    public function getController()
    {
        return $this->controller;
    }
}

After you updated your database schema you just need to add your routes to the new db table, for example:

title: test slug: test controller: AcmeDemoBundle:Default:index

thats it!

pguso avatar Sep 11 '14 13:09 pguso