cnjeca
Last Updated: May 03, 2017
·
3.065K
· bullhya
12042862 173545929651509 5261558023887214563 n

Symfony2 : StofDoctrineExtensionsBundle - Installation

1 - Composer :

"require": {
  "stof/doctrine-extensions-bundle": "dev-master"
}

2- Registration in app/AppKernel.php :

public function registerBundles()
{
  return array(
    // …
    new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
    // …
  );
}

3 - Activating the Extention in config.yml :

stof_doctrine_extensions:
    default_locale: en_US
    orm:
        default:
            sluggable: true
            timestampable: true # not needed: listeners are not enabled by default

4 - Using it :

namespace Sdz\BlogBundle\Entity;

namespace Savewall\CrawlBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

class Article
{
  // …

    /**
     * @Gedmo\Slug(fields={"title"})
     * @ORM\Column(length=128, unique=true)
     */
    private $slug;
}

Voila

Say Thanks
Respond