|
@@ -10,6 +10,7 @@ Features:
|
|
- Slugs can be unique and styled
|
|
- Slugs can be unique and styled
|
|
- Can be nested with other behaviors
|
|
- Can be nested with other behaviors
|
|
- Annotation, Yaml and Xml mapping support for extensions
|
|
- Annotation, Yaml and Xml mapping support for extensions
|
|
|
|
+- Multiple slugs
|
|
|
|
|
|
[blog_test]: http://gediminasm.org/test "Test extensions on this blog"
|
|
[blog_test]: http://gediminasm.org/test "Test extensions on this blog"
|
|
|
|
|
|
@@ -106,13 +107,13 @@ cache is activated
|
|
private $id;
|
|
private $id;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @gedmo:Sluggable
|
|
|
|
|
|
+ * @gedmo:Sluggable(slugField="slug")
|
|
* @Column(name="title", type="string", length=64)
|
|
* @Column(name="title", type="string", length=64)
|
|
*/
|
|
*/
|
|
private $title;
|
|
private $title;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @gedmo:Sluggable
|
|
|
|
|
|
+ * @gedmo:Sluggable(slugField="slug")
|
|
* @Column(name="code", type="string", length=16)
|
|
* @Column(name="code", type="string", length=16)
|
|
*/
|
|
*/
|
|
private $code;
|
|
private $code;
|
|
@@ -167,7 +168,7 @@ cache is activated
|
|
private $id;
|
|
private $id;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @gedmo:Sluggable
|
|
|
|
|
|
+ * @gedmo:Sluggable(slugField="slug")
|
|
* @String
|
|
* @String
|
|
*/
|
|
*/
|
|
private $title;
|
|
private $title;
|
|
@@ -233,12 +234,16 @@ Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**
|
|
type: string
|
|
type: string
|
|
length: 64
|
|
length: 64
|
|
gedmo:
|
|
gedmo:
|
|
- - sluggable
|
|
|
|
|
|
+ sluggable:
|
|
|
|
+ position: 0
|
|
|
|
+ fieldSlug: 'slug'
|
|
code:
|
|
code:
|
|
type: string
|
|
type: string
|
|
length: 16
|
|
length: 16
|
|
gedmo:
|
|
gedmo:
|
|
- - sluggable
|
|
|
|
|
|
+ sluggable:
|
|
|
|
+ position: 1
|
|
|
|
+ fieldSlug: 'slug'
|
|
slug:
|
|
slug:
|
|
type: string
|
|
type: string
|
|
length: 128
|
|
length: 128
|
|
@@ -290,13 +295,18 @@ Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**
|
|
echo $article->getSlug();
|
|
echo $article->getSlug();
|
|
// prints: the-title-my-code
|
|
// prints: the-title-my-code
|
|
|
|
|
|
-### Some other configuration options:
|
|
|
|
|
|
+### Some other configuration options for **slug** annotation:
|
|
|
|
|
|
- **updatable** (optional, default=true) - **true** to update the slug on sluggable field changes, **false** - otherwise
|
|
- **updatable** (optional, default=true) - **true** to update the slug on sluggable field changes, **false** - otherwise
|
|
- **unique** (optional, default=true) - **true** if slug should be unique and if identical it will be prefixed, **false** - otherwise
|
|
- **unique** (optional, default=true) - **true** if slug should be unique and if identical it will be prefixed, **false** - otherwise
|
|
- **separator** (optional, default="-") - separator which will separate words in slug
|
|
- **separator** (optional, default="-") - separator which will separate words in slug
|
|
- **style** (optional, default="default") - **"default"** all letters will be lowercase, **"camel"** - first word letter will be uppercase
|
|
- **style** (optional, default="default") - **"default"** all letters will be lowercase, **"camel"** - first word letter will be uppercase
|
|
|
|
|
|
|
|
+### Some other configuration options for **sluggable** annotation:
|
|
|
|
+
|
|
|
|
+- **slugField** (optional, default="slug") - the slug field where the slug will be stored
|
|
|
|
+
|
|
|
|
+
|
|
class Article
|
|
class Article
|
|
{
|
|
{
|
|
// ...
|
|
// ...
|
|
@@ -306,6 +316,14 @@ Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**
|
|
*/
|
|
*/
|
|
private $slug;
|
|
private $slug;
|
|
// ...
|
|
// ...
|
|
|
|
+
|
|
|
|
+ // ...
|
|
|
|
+ /**
|
|
|
|
+ * @gedmo:Sluggable(slugField="slug")
|
|
|
|
+ * @Column(name="title", type="string", length=128)
|
|
|
|
+ */
|
|
|
|
+ private $title;
|
|
|
|
+ // ...
|
|
}
|
|
}
|
|
|
|
|
|
And now test the result:
|
|
And now test the result:
|