stofdoctrineextensions - Symfony 2 - Generate Slugs with Gedmo\Slug -


I have now installed theory extensions to use sluggable.

I do it:

Composer. Jason

  "stof / doctrine-extensions-bundle": "1.2.*@dev"  

AppCernel.php

 < Code> new staff \ sinstituteia extension bundle \ staff doccr Extension Bundle (),  

app / config / config.yml

  stof_doctrine_extensions: orm: default: Lazy: true  

Dju \ Applebundle \ unit \ Nomenclature.php

  name space jade \ applebundle \ existence; Use the theory / ORM \ mapping as an ORM; Use the principle \ DBAL \ types \ SmallIntType; Use \ Mapping \ Annotation as Gedmo; / ** * Naming * * * @ORM \ Table (name = "app_nomenclature") * @ORM \ unit * / class naming {..... / ** * @ver string * * @ORM \ Column (name = "Titre", type = "string", length = 200, faucet = wrong) * / private $ title; / ** * @Wer String * * @ORM \ column (name = "fossa", type = "string", length = 10, faucet = true) * / private $ uprooted; / ** * @Gedmo \ slug (field = {"titre", "finess"}, suffix = ". Html") * @ORM \ column (length = 128, exclusive = true, nullable = true) * / private $ Slug; Public function getSlug () {return $ this-> slug; } Public Function Setlog ($ Slug) {$ this- & gt; Slug = $ slug; $ This return; }}  

In my controller I do this to generate slug for the old values ​​in my dataset:

  $ filterBuilder = $ this- & Gt; Doctrine.orm.entity_manager ') & gt; GetRepository ('DjooAppliBundle: Naming') - & gt; CreateQueryBuilder ('E') - & gt; Orderbie ('e.titre', 'asc'); $ Query = $ filterBuilder- & gt; GetQuery (); $ Naming = $ query- & gt; GetResult (); Foreign Currency ($ naming $ as nomenclature) {$ naming-> Set slug (empty); $ This- & gt; ('Doctrine.orm.entity_manager') - & gt; Continues ($ naming); $ This- & gt; Mill ('doctrine.orm.entity_manager') - & gt; Flush (); }  

I have no errors, but in my old values ​​there is a zero slug. I try to create a new element and I have a nice white. Do you have more ideas?

Thank you

To change the slug you have to change the related property you Add a location at the end of the $ titre , save it, change it back and save it again, it will flush the slug.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -