add slug for tags

This commit is contained in:
Nicolas Lœuillet 2015-10-14 21:30:25 +02:00 committed by Jeremy Benoist
parent 22c1d29b89
commit 3c65dfb735
5 changed files with 262 additions and 60 deletions

View File

@ -28,6 +28,7 @@ class AppKernel extends Kernel
new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new Wallabag\UserBundle\WallabagUserBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
);

View File

@ -90,6 +90,14 @@ doctrine:
default:
auto_mapping: true
stof_doctrine_extensions:
default_locale: "%locale%"
translation_fallback: true
orm:
default:
tree: true
sluggable: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
@ -119,6 +127,7 @@ fos_rest:
nelmio_api_doc:
sandbox:
enabled: false
name: wallabag API documentation
nelmio_cors:
defaults:

View File

@ -55,6 +55,7 @@
"j0k3r/graby": "~1.0",
"friendsofsymfony/user-bundle": "dev-master",
"friendsofsymfony/oauth-server-bundle": "^1.4@dev",
"stof/doctrine-extensions-bundle": "^1.2@dev",
"scheb/two-factor-bundle": "~1.4.0",
"grandt/phpepub": "~4.0",
"wallabag/php-mobi": "~1.0.0",

299
composer.lock generated
View File

@ -4,9 +4,49 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "cebe2bfc6f67c6f5e16e82f839fbb66b",
"content-hash": "b5d8700f351d76dbd25cf578f53c6df3",
"hash": "91da706ef4b39a73704c3e2154c1a227",
"content-hash": "81a3c2c84d78471bfb526b2b572182f7",
"packages": [
{
"name": "behat/transliterator",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/Behat/Transliterator.git",
"reference": "868e05be3a9f25ba6424c2dd4849567f50715003"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Behat/Transliterator/zipball/868e05be3a9f25ba6424c2dd4849567f50715003",
"reference": "868e05be3a9f25ba6424c2dd4849567f50715003",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-0": {
"Behat\\Transliterator": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Artistic-1.0"
],
"description": "String transliterator",
"keywords": [
"i18n",
"slug",
"transliterator"
],
"time": "2015-09-28 16:26:35"
},
{
"name": "doctrine/annotations",
"version": "v1.2.7",
@ -213,16 +253,16 @@
},
{
"name": "doctrine/common",
"version": "v2.5.2",
"version": "v2.6.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/common.git",
"reference": "311001fd9865a4d0d59efff4eac6d7dcb3f5270c"
"reference": "a579557bc689580c19fee4e27487a67fe60defc0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/common/zipball/311001fd9865a4d0d59efff4eac6d7dcb3f5270c",
"reference": "311001fd9865a4d0d59efff4eac6d7dcb3f5270c",
"url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0",
"reference": "a579557bc689580c19fee4e27487a67fe60defc0",
"shasum": ""
},
"require": {
@ -231,20 +271,20 @@
"doctrine/collections": "1.*",
"doctrine/inflector": "1.*",
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
"php": "~5.5|~7.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
"phpunit/phpunit": "~4.8|~5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5.x-dev"
"dev-master": "2.7.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\": "lib/"
"psr-4": {
"Doctrine\\Common\\": "lib/Doctrine/Common"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -282,24 +322,24 @@
"persistence",
"spl"
],
"time": "2015-12-04 12:49:42"
"time": "2015-12-25 13:18:31"
},
{
"name": "doctrine/dbal",
"version": "v2.5.2",
"version": "v2.5.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c"
"reference": "2fbcea96eae34a53183377cdbb0b9bec33974648"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/01dbcbc5cd0a913d751418e635434a18a2f2a75c",
"reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/2fbcea96eae34a53183377cdbb0b9bec33974648",
"reference": "2fbcea96eae34a53183377cdbb0b9bec33974648",
"shasum": ""
},
"require": {
"doctrine/common": ">=2.4,<2.6-dev",
"doctrine/common": ">=2.4,<2.7-dev",
"php": ">=5.3.2"
},
"require-dev": {
@ -353,7 +393,7 @@
"persistence",
"queryobject"
],
"time": "2015-09-16 16:29:33"
"time": "2015-12-25 16:28:24"
},
{
"name": "doctrine/doctrine-bundle",
@ -697,22 +737,22 @@
},
{
"name": "doctrine/orm",
"version": "v2.5.2",
"version": "v2.5.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/doctrine2.git",
"reference": "464b5fdbfbbeb4a65465ac173c4c5d90960f41ff"
"reference": "d9fc5388f1aa1751a0e148e76b4569bd207338e9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/doctrine2/zipball/464b5fdbfbbeb4a65465ac173c4c5d90960f41ff",
"reference": "464b5fdbfbbeb4a65465ac173c4c5d90960f41ff",
"url": "https://api.github.com/repos/doctrine/doctrine2/zipball/d9fc5388f1aa1751a0e148e76b4569bd207338e9",
"reference": "d9fc5388f1aa1751a0e148e76b4569bd207338e9",
"shasum": ""
},
"require": {
"doctrine/cache": "~1.4",
"doctrine/collections": "~1.2",
"doctrine/common": ">=2.5-dev,<2.6-dev",
"doctrine/common": ">=2.5-dev,<2.7-dev",
"doctrine/dbal": ">=2.5-dev,<2.6-dev",
"doctrine/instantiator": "~1.0.1",
"ext-pdo": "*",
@ -770,7 +810,7 @@
"database",
"orm"
],
"time": "2015-11-23 12:44:25"
"time": "2015-12-25 15:50:05"
},
{
"name": "ezyang/htmlpurifier",
@ -1094,6 +1134,85 @@
],
"time": "2015-12-05 09:38:57"
},
{
"name": "gedmo/doctrine-extensions",
"version": "v2.4.10",
"source": {
"type": "git",
"url": "https://github.com/Atlantic18/DoctrineExtensions.git",
"reference": "7e7fc55fa3fad79031727fbc7d8e418b641be875"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Atlantic18/DoctrineExtensions/zipball/7e7fc55fa3fad79031727fbc7d8e418b641be875",
"reference": "7e7fc55fa3fad79031727fbc7d8e418b641be875",
"shasum": ""
},
"require": {
"behat/transliterator": "~1.0",
"doctrine/common": "~2.4",
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/common": ">=2.5.0",
"doctrine/mongodb-odm": ">=1.0.2",
"doctrine/orm": ">=2.5.0",
"phpunit/phpunit": "~4.4",
"phpunit/phpunit-mock-objects": "~2.3",
"symfony/yaml": "~2.6"
},
"suggest": {
"doctrine/mongodb-odm": "to use the extensions with the MongoDB ODM",
"doctrine/orm": "to use the extensions with the ORM"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4.x-dev"
}
},
"autoload": {
"psr-0": {
"Gedmo\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "David Buchmann",
"email": "david@liip.ch"
},
{
"name": "Gediminas Morkevicius",
"email": "gediminas.morkevicius@gmail.com"
},
{
"name": "Gustavo Falco",
"email": "comfortablynumb84@gmail.com"
}
],
"description": "Doctrine2 behavioral extensions",
"homepage": "http://gediminasm.org/",
"keywords": [
"Blameable",
"behaviors",
"doctrine2",
"extensions",
"gedmo",
"loggable",
"nestedset",
"sluggable",
"sortable",
"timestampable",
"translatable",
"tree",
"uploadable"
],
"time": "2015-12-18 20:34:21"
},
{
"name": "grandt/binstring",
"version": "1.0.0",
@ -2194,16 +2313,16 @@
},
{
"name": "j0k3r/graby",
"version": "1.0.7",
"version": "1.0.8",
"source": {
"type": "git",
"url": "https://github.com/j0k3r/graby.git",
"reference": "301f8c492be4c9b2bed8f29c32641636de0eca0a"
"reference": "bf152ccc6629bdd63b1e5e8b297c2912516b5f1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/j0k3r/graby/zipball/301f8c492be4c9b2bed8f29c32641636de0eca0a",
"reference": "301f8c492be4c9b2bed8f29c32641636de0eca0a",
"url": "https://api.github.com/repos/j0k3r/graby/zipball/bf152ccc6629bdd63b1e5e8b297c2912516b5f1e",
"reference": "bf152ccc6629bdd63b1e5e8b297c2912516b5f1e",
"shasum": ""
},
"require": {
@ -2220,12 +2339,16 @@
"smalot/pdfparser": "~0.9.24",
"symfony/options-resolver": "~2.6|~3.0"
},
"require-dev": {
"satooshi/php-coveralls": "~0.6"
},
"type": "library",
"autoload": {
"psr-4": {
"Graby\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"AGPL-3.0"
],
@ -2242,23 +2365,20 @@
}
],
"description": "Graby helps you extract article content from web pages",
"support": {
"source": "https://github.com/bdunogier/graby/tree/1.0.7"
},
"time": "2015-12-16 10:21:48"
"time": "2015-12-24 08:28:38"
},
{
"name": "j0k3r/graby-site-config",
"version": "1.0.10",
"version": "1.0.11",
"source": {
"type": "git",
"url": "https://github.com/j0k3r/graby-site-config.git",
"reference": "daea5cdd2c3d89cb90402205392423030f8eebce"
"reference": "ac198f308beabccc97bbd35ed0daeaac63fbf1e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/daea5cdd2c3d89cb90402205392423030f8eebce",
"reference": "daea5cdd2c3d89cb90402205392423030f8eebce",
"url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/ac198f308beabccc97bbd35ed0daeaac63fbf1e3",
"reference": "ac198f308beabccc97bbd35ed0daeaac63fbf1e3",
"shasum": ""
},
"require": {
@ -2281,7 +2401,7 @@
}
],
"description": "Graby site config files",
"time": "2015-12-16 10:27:19"
"time": "2015-12-23 22:52:15"
},
{
"name": "j0k3r/php-readability",
@ -3032,16 +3152,16 @@
},
{
"name": "michelf/php-markdown",
"version": "1.5.1",
"version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/michelf/php-markdown.git",
"reference": "155287e4222d2dd69b6a21221617b50668d5892e"
"reference": "156e56ee036505ec637d761ee62dc425d807183c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/155287e4222d2dd69b6a21221617b50668d5892e",
"reference": "155287e4222d2dd69b6a21221617b50668d5892e",
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/156e56ee036505ec637d761ee62dc425d807183c",
"reference": "156e56ee036505ec637d761ee62dc425d807183c",
"shasum": ""
},
"require": {
@ -3079,7 +3199,7 @@
"keywords": [
"markdown"
],
"time": "2015-12-22 18:18:12"
"time": "2015-12-24 01:37:31"
},
{
"name": "monolog/monolog",
@ -3998,6 +4118,67 @@
],
"time": "2014-03-31 09:18:53"
},
{
"name": "stof/doctrine-extensions-bundle",
"version": "v1.2.1",
"source": {
"type": "git",
"url": "https://github.com/stof/StofDoctrineExtensionsBundle.git",
"reference": "7b3144572617b0555f9a443317dbc2f9cf5b524e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stof/StofDoctrineExtensionsBundle/zipball/7b3144572617b0555f9a443317dbc2f9cf5b524e",
"reference": "7b3144572617b0555f9a443317dbc2f9cf5b524e",
"shasum": ""
},
"require": {
"gedmo/doctrine-extensions": "^2.3.1",
"php": ">=5.3.2",
"symfony/framework-bundle": "~2.1"
},
"suggest": {
"doctrine/doctrine-bundle": "to use the ORM extensions",
"doctrine/mongodb-odm-bundle": "to use the MongoDB ODM extensions"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"psr-4": {
"Stof\\DoctrineExtensionsBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christophe Coevoet",
"email": "stof@notk.org"
}
],
"description": "Integration of the gedmo/doctrine-extensions with Symfony2",
"homepage": "https://github.com/stof/StofDoctrineExtensionsBundle",
"keywords": [
"behaviors",
"doctrine2",
"extensions",
"gedmo",
"loggable",
"nestedset",
"sluggable",
"sortable",
"timestampable",
"translatable",
"tree"
],
"time": "2015-08-12 16:23:48"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v5.4.1",
@ -4239,16 +4420,16 @@
},
{
"name": "symfony/symfony",
"version": "v2.7.7",
"version": "v2.7.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/symfony.git",
"reference": "cc69dbd24b4b2e6de60b2414ef95da2794f459a2"
"reference": "ad264021e44a5aaa132f16aef69f92e56795683e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/symfony/zipball/cc69dbd24b4b2e6de60b2414ef95da2794f459a2",
"reference": "cc69dbd24b4b2e6de60b2414ef95da2794f459a2",
"url": "https://api.github.com/repos/symfony/symfony/zipball/ad264021e44a5aaa132f16aef69f92e56795683e",
"reference": "ad264021e44a5aaa132f16aef69f92e56795683e",
"shasum": ""
},
"require": {
@ -4359,7 +4540,7 @@
"keywords": [
"framework"
],
"time": "2015-11-23 11:58:08"
"time": "2015-12-26 15:02:06"
},
{
"name": "tecnickcom/tcpdf",
@ -4563,27 +4744,24 @@
"MOBIClass/MOBI.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Sander Kromwijk",
"email": "s.kromwijk@gmail.co",
"role": "Original developer"
},
{
"name": "Nicolas Lœuillet",
"email": "nicolas@loeuillet.org",
"homepage": "http://www.cdetc.fr"
},
{
"name": "Sander Kromwijk",
"email": "s.kromwijk@gmail.co",
"role": "Original developer"
}
],
"description": "A Mobipocket file (.mobi) creator in PHP.",
"homepage": "https://github.com/wallabag/phpMobi",
"support": {
"source": "https://github.com/wallabag/php-mobi/tree/1.0.1",
"issues": "https://github.com/wallabag/php-mobi/issues"
},
"time": "2015-10-16 08:42:42"
},
{
@ -4692,7 +4870,7 @@
],
"authors": [
{
"name": "William DURAND",
"name": "William Durand",
"email": "william.durand1@gmail.com"
}
],
@ -5806,7 +5984,7 @@
},
{
"name": "symfony/phpunit-bridge",
"version": "v2.7.7",
"version": "v2.7.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/phpunit-bridge.git",
@ -5864,12 +6042,13 @@
"minimum-stability": "dev",
"stability-flags": {
"friendsofsymfony/user-bundle": 20,
"friendsofsymfony/oauth-server-bundle": 20
"friendsofsymfony/oauth-server-bundle": 20,
"stof/doctrine-extensions-bundle": 20
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.3"
"php": ">=5.5.0"
},
"platform-dev": []
}

View File

@ -7,6 +7,7 @@ use JMS\Serializer\Annotation\XmlRoot;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Tag.
@ -36,6 +37,12 @@ class Tag
*/
private $label;
/**
* @Gedmo\Slug(fields={"label"})
* @ORM\Column(length=128, unique=true)
*/
private $slug;
/**
* @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
*/
@ -91,6 +98,11 @@ class Tag
return $this->label;
}
public function getSlug()
{
return $this->slug;
}
public function addEntry(Entry $entry)
{
$this->entries[] = $entry;