symfony - Slug not generated when persisting Entity to Database -


i'm using doctrineextensions , followed docs. have entity field decorated sluggable annotation:

   use gedmo\mapping\annotation gedmo;    .    .    .    /**      * @gedmo\slug(fields={"city"}, updatable=false)      * @orm\column(length=255)      */     private $slug; 

when try persist new entity sql error:

persist:

        $em = $this->getdoctrine()->getmanager();         $em->persist($location);         $em->flush(); 

error:

sqlstate[23000]: integrity constraint violation: 1048 column 'slug' cannot null 

config.yml:

# stof doctrine extensions stof_doctrine_extensions:     orm:         default:             sluggable: true 

according docs need, yet slug not being generated.

this simple on looked. did not have field mapped in orm.xml file... once added mapping worked:

<field name="slug" type="string" column="slug" length="255" nullable="false">     <gedmo:slug fields="city" updatable="false" /> </field> 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -