Sluggable doesn't work on server

时间:2015-09-14 15:20:35

标签: symfony doctrine-orm

I'm having an issue with the Doctrine Extension : Sluggable.
I have an entity called Folder with an attribut slug.

/**
 * @var string
 *
 * @ORM\Column(name="slug", type="string", length=255)
 * @Gedmo\Slug(fields={"name"}, unique=false)
 */
private $slug;

And here's my controller :

/**
 * @param Folder $folder
 * @return array
 * @Template
 * @ParamConverter("folder", options={"mapping":{"id": "id", "slug": "slug"}})
 */
public function showAction(Folder $folder = null, $slug = null)
{
$newFolder = new Folder;
$formFolder = $this->createForm(new FolderType, $newFolder);

if ($this->request->isMethod('POST')) {
    $formFolder->handleRequest($this->request);

    if ($formFolder->isValid()) {
        $this->em->persist($newFolder);
        $this->em->flush();

        return $this->redirectToRoute('ag_vault_folder_show', array(
            'id' => $newFolder->getId(),
            'slug' => $newFolder->getSlug()
        ));
    }
}

My config.yml file for the extension is this :

# DoctrineExtensionBundle Configuration
stof_doctrine_extensions:
    orm:
        default:
            blameable: true
            uploadable: true
            sluggable: true
    uploadable:
        default_file_path:       %kernel.root_dir%/../web/uploads/files
        mime_type_guesser_class: Stof\DoctrineExtensionsBundle\Uploadable\MimeTypeGuesserAdapter
        default_file_info_class: Stof\DoctrineExtensionsBundle\Uploadable\UploadedFileInfo

And my routing file for this page is this one :

ag_vault_folder_show:
    path: /{id}-{slug}
    defaults:
        _controller: AGVaultBundle:Folder:show
        slug: null
    requirements:
        id: \d+
        slug: "[a-zA-Z0-9-_/]+"

The problem is that the slug is correctly generated by the Sluggable extension on my localhost website, but it doesn't work when I deploy the code on my server. I don't know why and I'm kinda lost right now.

0 个答案:

没有答案