Explorar o código

[sluggable] cleanup after handler removal

gedi %!s(int64=13) %!d(string=hai) anos
pai
achega
f693cf408d

+ 16 - 16
README.md

@@ -9,6 +9,10 @@ master branch is based on 2.3.x versions and may not work with older components.
 
 ### Latest updates
 
+**2012-02-26**
+
+- Removed slug handlers, this functionality brought complucations which could not be maintained.
+
 **2012-02-15**
 
 - Add option to force **Translatable** store translation in default locale like any other.
@@ -53,13 +57,13 @@ offer new functionality or tools to use Doctrine2 more efficently. This package
 used behaviors which can be easily attached to your event system of Doctrine2 and handle the
 records being flushed in the behavioral way. List of extensions:
 
-- Tree - this extension automates the tree handling process and adds some tree specific functions on repository. (closure or nestedset)
-- Translatable - gives you a very handy solution for translating records into diferent languages. Easy to setup, easier to use.
-- Sluggable - urlizes your specified fields into single unique slug
-- Timestampable - updates date fields on create, update and even property change.
-- Loggable - helps tracking changes and history of objects, also supports version managment.
-- Sortable - makes any document or entity sortable
-- Translator - explicit way to handle translations
+- **Tree** - this extension automates the tree handling process and adds some tree specific functions on repository. (closure or nestedset)
+- **Translatable** - gives you a very handy solution for translating records into diferent languages. Easy to setup, easier to use.
+- **Sluggable** - urlizes your specified fields into single unique slug
+- **Timestampable** - updates date fields on create, update and even property change.
+- **Loggable** - helps tracking changes and history of objects, also supports version managment.
+- **Sortable** - makes any document or entity sortable
+- **Translator** - explicit way to handle translations
 
 Currently these extensions support **Yaml**, **Annotation**  and **Xml** mapping. Additional mapping drivers
 can be easily implemented using Mapping extension to handle the additional metadata mapping.
@@ -126,16 +130,12 @@ To setup and run example follow these steps:
 
 ### Contributors:
 
-- acasademont [acasademont](https://github.com/acasademont)
+Thanks to [everyone participating](http://github.com/l3pp4rd/DoctrineExtensions/contributors) in
+the development of these great Doctrine2 extensions!
+
+And especialy ones who create and maintain new extensions:
+
 - Lukas Botsch [lbotsch](http://github.com/lbotsch)
-- Daniel Gomes [danielcsgomes](http://github.com/danielcsgomes)
-- megabite [oscarballadares](http://github.com/oscarballadares)
-- DinoWeb [dinoweb](http://github.com/dinoweb)
-- Miha Vrhovnik [mvrhov](http://github.com/mvrhov)
-- Clément JOBEILI [dator](http://github.com/dator)
-- Illya Klymov [xanf](http://github.com/xanf)
 - Gustavo Adrian [comfortablynumb](http://github.com/comfortablynumb)
 - Boussekeyt Jules [gordonslondon](http://github.com/gordonslondon)
-- Christophe Coevoet [stof](http://github.com/stof)
 - Kudryashov Konstantin [everzet](http://github.com/everzet)
-- Klein Florian [docteurklein](http://github.com/docteurklein)

+ 7 - 233
doc/sluggable.md

@@ -11,11 +11,15 @@ Features:
 - Can be nested with other behaviors
 - Annotation, Yaml and Xml mapping support for extensions
 - Multiple slugs, diferent slugs can link to same fields
-- Built-in slug handlers, for tree path based slugs or linked by relation
 
 [blog_reference]: http://gediminasm.org/article/sluggable-behavior-extension-for-doctrine-2 "Sluggable extension for Doctrine 2 makes automatic record field transformations into url friendly names"
 [blog_test]: http://gediminasm.org/test "Test extensions on this blog"
 
+Update **2012-02-26**
+
+- Remove slug handlers were removed because of complications it brought together
+
+
 Update **2011-09-11**
 
 - Refactored sluggable for doctrine2.2 by specifieng slug fields directly in slug annotation
@@ -39,7 +43,7 @@ does not work on OSX 10.6 its ok starting again from 10.7 version. To overcome t
 you can use your [custom transliterator](#transliterator)
 - You can [test live][blog_test] on this blog
 - Public [Sluggable repository](http://github.com/l3pp4rd/DoctrineExtensions "Sluggable extension on Github") is available on github
-- Last update date: **2012-02-04**
+- Last update date: **2012-02-26**
 
 **Portability:**
 
@@ -82,7 +86,7 @@ on how to setup and use the extensions in most optimized way.
 you need to identify entity as being Sluggable. The metadata is loaded only once then
 cache is activated
 
-**Note:** 2.1.x version of extensions used @Gedmo\Mapping\Annotation\Sluggable to identify
+**Note:** 2.0.x version of extensions used @Gedmo\Mapping\Annotation\Sluggable to identify
 the field for slug
 
 ``` php
@@ -316,65 +320,6 @@ echo $article->getSlug();
 - **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
 - **style** (optional, default="default") - **"default"** all letters will be lowercase, **"camel"** - first word letter will be uppercase
-- **handlers** (optional, default=[]) - list of slug handlers, like tree path slug, or customized, for example see bellow
-
-**Note**: handlers are totally optional
-
-**TreeSlugHandler**
-
-``` php
-<?php
-/**
- * @Gedmo\Mapping\Annotation\Slug(handlers={
- *      @Gedmo\Mapping\Annotation\SlugHandler(class="Gedmo\Sluggable\Handler\TreeSlugHandler", options={
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="parentRelationField", value="parent"),
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="separator", value="/")
- *      })
- * }, fields={"title", "code"})
- * @Doctrine\ORM\Mapping\Column(length=64, unique=true)
- */
-private $slug;
-```
-
-**RelativeSlugHandler**:
-
-``` php
-<?php
-/**
- * Person domain object class
- *
- * @Gedmo\Mapping\Annotation\Slug(handlers={
- *      @Gedmo\Mapping\Annotation\SlugHandler(class="Gedmo\Sluggable\Handler\RelativeSlugHandler", options={
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="relationField", value="category"),
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="relationSlugField", value="slug"),
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="separator", value="/")
- *      })
- * }, fields={"title", "code"})
- * @Doctrine\ORM\Mapping\Column(length=64, unique=true)
- */
-private $slug;
-```
-
-**Note:** if you used **RelativeSlugHandler** - relation object should use in order to sync changes:
-
-**InversedRelativeSlugHandler**
-
-``` php
-<?php
-/**
- * Category domain object class
- *
- * @Gedmo\Mapping\Annotation\Slug(handlers={
- *      @Gedmo\Mapping\Annotation\SlugHandler(class="Gedmo\Sluggable\Handler\InversedRelativeSlugHandler", options={
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="relationClass", value="App\Entity\Person"),
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="mappedBy", value="category"),
- *          @Gedmo\Mapping\Annotation\SlugHandlerOption(name="inverseSlugField", value="slug")
- *      })
- * }, fields={"title"})
- * @Doctrine\ORM\Mapping\Column(length=64, unique=true)
- */
-private $slug;
-```
 
 ### Example
 
@@ -548,175 +493,4 @@ class Article
 
 Now the generated slug will be translated by Translatable behavior
 
-<a name="slug-handlers"></a>
-
-## Using slug handlers:
-
-There are built-in slug handlers like described in configuration options of slug, but there
-can be also customized slug handlers depending on use cases. Usually the most logic use case
-is for related slug. For instance if user has a **ManyToOne relation to a **Company** we
-would like to have a url like **http://example.com/knplabs/gedi where **KnpLabs**
-is a company and user name is **Gedi**. In this case relation has a path separator **/**
-
-User entity example:
-
-``` php
-<?php
-namespace Sluggable\Fixture\Handler;
-
-use Gedmo\Mapping\Annotation as Gedmo;
-use Doctrine\ORM\Mapping as ORM;
-
-/**
- * @ORM\Entity
- */
-class User
-{
-    /**
-     * @ORM\Id
-     * @ORM\GeneratedValue
-     * @ORM\Column(type="integer")
-     */
-    private $id;
-
-    /**
-     * @ORM\Column(length=64)
-     */
-    private $username;
-
-    /**
-     * @Gedmo\Slug(handlers={
-     *      @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\RelativeSlugHandler", options={
-     *          @Gedmo\SlugHandlerOption(name="relationField", value="company"),
-     *          @Gedmo\SlugHandlerOption(name="relationSlugField", value="alias"),
-     *          @Gedmo\SlugHandlerOption(name="separator", value="/")
-     *      })
-     * }, separator="-", updatable=true, fields={"username"})
-     * @ORM\Column(length=64, unique=true)
-     */
-    private $slug;
-
-    /**
-     * @ORM\ManyToOne(targetEntity="Company")
-     */
-    private $company;
-
-    public function setCompany(Company $company = null)
-    {
-        $this->company = $company;
-    }
-
-    public function getCompany()
-    {
-        return $this->company;
-    }
-
-    public function getId()
-    {
-        return $this->id;
-    }
-
-    public function setName($name)
-    {
-        $this->name = $name;
-    }
-
-    public function getName()
-    {
-        return $this->name;
-    }
-
-    public function getSlug()
-    {
-        return $this->slug;
-    }
-}
-```
-
-Company entity example:
-
-``` php
-<?php
-namespace Sluggable\Fixture\Handler;
-
-use Gedmo\Mapping\Annotation as Gedmo;
-use Doctrine\ORM\Mapping as ORM;
-
-/**
- * @ORM\Entity
- */
-class Company
-{
-    /**
-     * @ORM\Id
-     * @ORM\GeneratedValue
-     * @ORM\Column(type="integer")
-     */
-    private $id;
-
-    /**
-     * @ORM\Column(length=64)
-     */
-    private $title;
-
-    /**
-     * @Gedmo\Slug(handlers={
-     *      @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\InversedRelativeSlugHandler", options={
-     *          @Gedmo\SlugHandlerOption(name="relationClass", value="Sluggable\Fixture\Handler\User"),
-     *          @Gedmo\SlugHandlerOption(name="mappedBy", value="company"),
-     *          @Gedmo\SlugHandlerOption(name="inverseSlugField", value="slug")
-     *      })
-     * }, fields={"title"})
-     * @ORM\Column(length=64, unique=true)
-     */
-    private $alias;
-
-    public function getId()
-    {
-        return $this->id;
-    }
-
-    public function setTitle($title)
-    {
-        $this->title = $title;
-    }
-
-    public function getTitle()
-    {
-        return $this->title;
-    }
-
-    public function getAlias()
-    {
-        return $this->alias;
-    }
-}
-```
-
-And the example usage:
-
-``` php
-<?php
-$company = new Company;
-$company->setTitle('KnpLabs');
-$em->persist($company);
-
-$gedi = new User;
-$gedi->setUsername('Gedi');
-$gedi->setCompany($company);
-$em->persist($gedi);
-
-$em->flush();
-
-echo $gedi->getSlug(); // outputs "knplabs/gedi"
-
-$company->setTitle('KnpLabs Nantes');
-$em->persist($company);
-$em->flush();
-
-echo $gedi->getSlug(); // outputs "knplabs-nantes/gedi"
-```
-
-**Note:** tree slug handler, takes a parent relation to build slug recursively.
-
 Any suggestions on improvements are very welcome

+ 1 - 3
lib/Gedmo/Mapping/Annotation/All.php

@@ -14,8 +14,6 @@ include __DIR__.'/Language.php';
 include __DIR__.'/Locale.php';
 include __DIR__.'/Loggable.php';
 include __DIR__.'/Slug.php';
-include __DIR__.'/SlugHandler.php';
-include __DIR__.'/SlugHandlerOption.php';
 include __DIR__.'/SortableGroup.php';
 include __DIR__.'/SortablePosition.php';
 include __DIR__.'/Timestampable.php';
@@ -28,4 +26,4 @@ include __DIR__.'/TreeLevel.php';
 include __DIR__.'/TreeParent.php';
 include __DIR__.'/TreeRight.php';
 include __DIR__.'/TreeRoot.php';
-include __DIR__.'/Versioned.php';
+include __DIR__.'/Versioned.php';

+ 0 - 38
lib/Gedmo/Mapping/Annotation/SlugHandler.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace Gedmo\Mapping\Annotation;
-
-use Doctrine\Common\Annotations\Annotation;
-
-/**
- * SlugHandler annotation for Sluggable behavioral extension
- *
- * @Gedmo\Slug(handlers={
- *      @Gedmo\SlugHandler(class="Some\Class", options={
- *          @Gedmo\SlugHandlerOption(name="relation", value="parent"),
- *          @Gedmo\SlugHandlerOption(name="separator", value="/")
- *      }),
- *      @Gedmo\SlugHandler(class="Some\Class", options={
- *          @Gedmo\SlugHandlerOption(name="option", value="val"),
- *          ...
- *      }),
- *      ...
- * }, separator="-", updatable=false)
- *
- * @Annotation
- * @Target("ANNOTATION")
- *
- * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
- * @package Gedmo.Mapping.Annotation
- * @subpackage SlugHandler
- * @link http://www.gediminasm.org
- * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
- */
-final class SlugHandler extends Annotation
-{
-    /** @var string @required */
-    public $class;
-    /** @var array<Gedmo\Mapping\Annotation\SlugHandlerOption> */
-    public $options = array();
-}
-

+ 0 - 38
lib/Gedmo/Mapping/Annotation/SlugHandlerOption.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace Gedmo\Mapping\Annotation;
-
-use Doctrine\Common\Annotations\Annotation;
-
-/**
- * SlugHandlerOption annotation for Sluggable behavioral extension
- *
- * @Gedmo\Slug(handlers={
- *      @Gedmo\SlugHandler(class="Some\Class", options={
- *          @Gedmo\SlugHandlerOption(name="relation", value="parent"),
- *          @Gedmo\SlugHandlerOption(name="separator", value="/")
- *      }),
- *      @Gedmo\SlugHandler(class="Some\Class", options={
- *          @Gedmo\SlugHandlerOption(name="option", value="val"),
- *          ...
- *      }),
- *      ...
- * }, separator="-", updatable=false)
- *
- * @Annotation
- * @Target("ANNOTATION")
- *
- * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
- * @package Gedmo.Mapping.Annotation
- * @subpackage SlugHandlerOption
- * @link http://www.gediminasm.org
- * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
- */
-final class SlugHandlerOption extends Annotation
-{
-    /** @var string */
-    public $name;
-    /** @var mixed */
-    public $value;
-}
-

+ 1 - 36
lib/Gedmo/Sluggable/Mapping/Driver/Annotation.php

@@ -28,16 +28,6 @@ class Annotation implements AnnotationDriverInterface
      */
     const SLUG = 'Gedmo\\Mapping\\Annotation\\Slug';
 
-    /**
-     * SlugHandler extension annotation
-     */
-    const HANDLER = 'Gedmo\\Mapping\\Annotation\\SlugHandler';
-
-    /**
-     * SlugHandler option annotation
-     */
-    const HANDLER_OPTION ='Gedmo\\Mapping\\Annotation\\SlugHandlerOption';
-
     /**
      * List of types which are valid for slug and sluggable fields
      *
@@ -97,30 +87,6 @@ class Annotation implements AnnotationDriverInterface
                 if (!$this->isValidField($meta, $field)) {
                     throw new InvalidMappingException("Cannot use field - [{$field}] for slug storage, type is not valid and must be 'string' or 'text' in class - {$meta->name}");
                 }
-                // process slug handlers
-                $handlers = array();
-                if (is_array($slug->handlers) && $slug->handlers) {
-                    foreach ($slug->handlers as $handler) {
-                        if (!$handler instanceof SlugHandler) {
-                            throw new InvalidMappingException("SlugHandler: {$handler} should be instance of SlugHandler annotation in entity - {$meta->name}");
-                        }
-                        if (!strlen($handler->class)) {
-                            throw new InvalidMappingException("SlugHandler class: {$handler->class} should be a valid class name in entity - {$meta->name}");
-                        }
-                        $class = $handler->class;
-                        $handlers[$class] = array();
-                        foreach ((array)$handler->options as $option) {
-                            if (!$option instanceof SlugHandlerOption) {
-                                throw new InvalidMappingException("SlugHandlerOption: {$option} should be instance of SlugHandlerOption annotation in entity - {$meta->name}");
-                            }
-                            if (!strlen($option->name)) {
-                                throw new InvalidMappingException("SlugHandlerOption name: {$option->name} should be valid name in entity - {$meta->name}");
-                            }
-                            $handlers[$class][$option->name] = $option->value;
-                        }
-                        $class::validate($handlers[$class], $meta);
-                    }
-                }
                 // process slug fields
                 if (empty($slug->fields) || !is_array($slug->fields)) {
                     throw new InvalidMappingException("Slug must contain at least one field for slug generation in class - {$meta->name}");
@@ -150,7 +116,6 @@ class Annotation implements AnnotationDriverInterface
                     'updatable' => $slug->updatable,
                     'unique' => $slug->unique,
                     'separator' => $slug->separator,
-                    'handlers' => $handlers
                 );
             }
         }
@@ -179,4 +144,4 @@ class Annotation implements AnnotationDriverInterface
     {
         $this->_originalDriver = $driver;
     }
-}
+}

+ 0 - 14
lib/Gedmo/Sluggable/Mapping/Driver/Xml.php

@@ -69,19 +69,6 @@ class Xml extends BaseXml
                         }
                     }
 
-                    $handlers = array();
-                    if (isset($slug->handler)) {
-                        foreach ($slug->handler as $handler) {
-                            $class = (string)$this->_getAttribute($handler, 'class');
-                            $handlers[$class] = array();
-                            foreach ($handler->{'handler-option'} as $option) {
-                                $handlers[$class][(string)$this->_getAttribute($option, 'name')]
-                                    = (string)$this->_getAttribute($option, 'value')
-                                ;
-                            }
-                            $class::validate($handlers[$class], $meta);
-                        }
-                    }
                     // set all options
                     $config['slugs'][$field] = array(
                         'fields' => $fields,
@@ -94,7 +81,6 @@ class Xml extends BaseXml
                             (bool)$this->_getAttribute($slug, 'unique') : true,
                         'separator' => $this->_isAttributeSet($slug, 'separator') ?
                             $this->_getAttribute($slug, 'separator') : '-',
-                        'handlers' => $handlers
                     );
                     if ($meta->isIdentifier($field) && !$config['slugs'][$field]['unique']) {
                         throw new InvalidMappingException("Identifier field - [{$field}] slug must be unique in order to maintain primary key in class - {$meta->name}");

+ 0 - 12
lib/Gedmo/Sluggable/Mapping/Driver/Yaml.php

@@ -52,17 +52,6 @@ class Yaml extends File implements Driver
                         if (!$this->isValidField($meta, $field)) {
                             throw new InvalidMappingException("Cannot use field - [{$field}] for slug storage, type is not valid and must be 'string' or 'text' in class - {$meta->name}");
                         }
-                        // process slug handlers
-                        $handlers = array();
-                        if (isset($slug['handlers'])) {
-                            foreach ($slug['handlers'] as $handlerClass => $options) {
-                                if (!strlen($handlerClass)) {
-                                    throw new InvalidMappingException("SlugHandler class: {$handlerClass} should be a valid class name in entity - {$meta->name}");
-                                }
-                                $handlers[$handlerClass] = $options;
-                                $handlerClass::validate($handlers[$handlerClass], $meta);
-                            }
-                        }
                         // process slug fields
                         if (empty($slug['fields']) || !is_array($slug['fields'])) {
                             throw new InvalidMappingException("Slug must contain at least one field for slug generation in class - {$meta->name}");
@@ -77,7 +66,6 @@ class Yaml extends File implements Driver
                         }
 
                         $config['slugs'][$field]['fields'] = $slug['fields'];
-                        $config['slugs'][$field]['handlers'] = $handlers;
                         $config['slugs'][$field]['slug'] = $field;
                         $config['slugs'][$field]['style'] = isset($slug['style']) ?
                             (string)$slug['style'] : 'default';

+ 1 - 12
tests/Gedmo/Mapping/Driver/Xml/Mapping.Fixture.Xml.Sluggable.dcm.xml

@@ -11,19 +11,8 @@
         <field name="code" type="string" length="16"/>
         <field name="ean" type="string" length="13"/>
         <field name="slug" type="string" length="156" unique="true">
-            <gedmo:slug unique="true" style="camel" updatable="false" separator="_" fields="title, ean, code">
-                <gedmo:handler class="Gedmo\Sluggable\Handler\TreeSlugHandler">
-                    <gedmo:handler-option name="parentRelationField" value="parent"/>
-                    <gedmo:handler-option name="separator" value="/"/>
-                </gedmo:handler>
-                <gedmo:handler class="Gedmo\Sluggable\Handler\RelativeSlugHandler">
-                    <gedmo:handler-option name="relationField" value="parent"/>
-                    <gedmo:handler-option name="relationSlugField" value="test"/>
-                    <gedmo:handler-option name="separator" value="-"/>
-                </gedmo:handler>
-            </gedmo:slug>
+            <gedmo:slug unique="true" style="camel" updatable="false" separator="_" fields="title, ean, code" />
         </field>
-        
         <many-to-one field="parent" target-entity="Sluggable">
             <join-column name="parent_id" referenced-column-name="id" on-delete="SET_NULL"/>
         </many-to-one>

+ 0 - 32
tests/Gedmo/Mapping/SluggableMappingTest.php

@@ -79,36 +79,4 @@ class SluggableMappingTest extends \PHPUnit_Framework_TestCase
         $this->assertArrayHasKey('updatable', $config['slugs']['slug']);
         $this->assertTrue($config['slugs']['slug']['updatable']);
     }
-
-    public function testSlugHandlerMapping()
-    {
-        $meta = $this->em->getClassMetadata(self::SLUGGABLE);
-        $cacheId = ExtensionMetadataFactory::getCacheId(
-            self::SLUGGABLE,
-            'Gedmo\Sluggable'
-        );
-        $config = $this->em->getMetadataFactory()->getCacheDriver()->fetch($cacheId);
-
-        $this->assertArrayHasKey('handlers', $config['slugs']['slug']);
-        $handlers = $config['slugs']['slug']['handlers'];
-        $this->assertEquals(2, count($handlers));
-        $this->assertArrayHasKey('Gedmo\Sluggable\Handler\TreeSlugHandler', $handlers);
-        $this->assertArrayHasKey('Gedmo\Sluggable\Handler\RelativeSlugHandler', $handlers);
-
-        $first = $handlers['Gedmo\Sluggable\Handler\TreeSlugHandler'];
-        $this->assertEquals(2, count($first));
-        $this->assertArrayHasKey('parentRelationField', $first);
-        $this->assertArrayHasKey('separator', $first);
-        $this->assertEquals('parent', $first['parentRelationField']);
-        $this->assertEquals('/', $first['separator']);
-
-        $second = $handlers['Gedmo\Sluggable\Handler\RelativeSlugHandler'];
-        $this->assertEquals(3, count($second));
-        $this->assertArrayHasKey('relationField', $second);
-        $this->assertArrayHasKey('relationSlugField', $second);
-        $this->assertArrayHasKey('separator', $second);
-        $this->assertEquals('user', $second['relationField']);
-        $this->assertEquals('slug', $second['relationSlugField']);
-        $this->assertEquals('/', $second['separator']);
-    }
 }

+ 0 - 23
tests/Gedmo/Mapping/Xml/SluggableMappingTest.php

@@ -77,28 +77,5 @@ class SluggableMappingTest extends BaseTestCaseORM
         $this->assertEquals('title', $fields[0]);
         $this->assertEquals('ean', $fields[1]);
         $this->assertEquals('code', $fields[2]);
-
-        $this->assertArrayHasKey('handlers', $config);
-        $this->assertEquals(2, count($config['handlers']));
-        $handlers = $config['handlers'];
-
-        $this->assertArrayHasKey('Gedmo\Sluggable\Handler\TreeSlugHandler', $handlers);
-        $this->assertArrayHasKey('Gedmo\Sluggable\Handler\RelativeSlugHandler', $handlers);
-
-        $first = $handlers['Gedmo\Sluggable\Handler\TreeSlugHandler'];
-        $this->assertEquals(2, count($first));
-        $this->assertArrayHasKey('parentRelationField', $first);
-        $this->assertArrayHasKey('separator', $first);
-        $this->assertEquals('parent', $first['parentRelationField']);
-        $this->assertEquals('/', $first['separator']);
-
-        $second = $handlers['Gedmo\Sluggable\Handler\RelativeSlugHandler'];
-        $this->assertEquals(3, count($second));
-        $this->assertArrayHasKey('relationField', $second);
-        $this->assertArrayHasKey('relationSlugField', $second);
-        $this->assertArrayHasKey('separator', $second);
-        $this->assertEquals('parent', $second['relationField']);
-        $this->assertEquals('test', $second['relationSlugField']);
-        $this->assertEquals('-', $second['separator']);
     }
 }

+ 1 - 7
tests/Gedmo/Sluggable/Fixture/Document/Article.php

@@ -24,13 +24,7 @@ class Article
     private $code;
 
     /**
-     * @Gedmo\Slug(handlers={
-     *      @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\InversedRelativeSlugHandler", options={
-     *          @Gedmo\SlugHandlerOption(name="relationClass", value="Sluggable\Fixture\Document\RelativeSlug"),
-     *          @Gedmo\SlugHandlerOption(name="mappedBy", value="article"),
-     *          @Gedmo\SlugHandlerOption(name="inverseSlugField", value="alias")
-     *      })
-     * }, separator="-", updatable=true, fields={"title", "code"})
+     * @Gedmo\Slug(separator="-", updatable=true, fields={"title", "code"})
      * @ODM\String
      */
     private $slug;

+ 0 - 69
tests/Gedmo/Sluggable/Fixture/Document/RelativeSlug.php

@@ -1,69 +0,0 @@
-<?php
-
-namespace Sluggable\Fixture\Document;
-
-use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
-use Gedmo\Mapping\Annotation as Gedmo;
-
-/**
- * @ODM\Document
- */
-class RelativeSlug
-{
-    /**
-     * @ODM\Id
-     */
-    private $id;
-
-    /**
-     * @ODM\String
-     */
-    private $title;
-
-    /**
-     * @Gedmo\Slug(handlers={
-     *      @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\RelativeSlugHandler", options={
-     *          @Gedmo\SlugHandlerOption(name="relationField", value="article"),
-     *          @Gedmo\SlugHandlerOption(name="relationSlugField", value="slug"),
-     *          @Gedmo\SlugHandlerOption(name="separator", value="/")
-     *      })
-     * }, separator="-", updatable=true, fields={"title"})
-     * @ODM\String
-     */
-    private $alias;
-
-    /**
-     * @ODM\ReferenceOne(targetDocument="Article")
-     */
-    private $article;
-
-    public function setArticle(Article $article = null)
-    {
-        $this->article = $article;
-    }
-
-    public function getArticle()
-    {
-        return $this->article;
-    }
-
-    public function getId()
-    {
-        return $this->id;
-    }
-
-    public function setTitle($title)
-    {
-        $this->title = $title;
-    }
-
-    public function getTitle()
-    {
-        return $this->title;
-    }
-
-    public function getSlug()
-    {
-        return $this->alias;
-    }
-}

+ 0 - 68
tests/Gedmo/Sluggable/Fixture/Document/TreeSlug.php

@@ -1,68 +0,0 @@
-<?php
-
-namespace Sluggable\Fixture\Document;
-
-use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
-use Gedmo\Mapping\Annotation as Gedmo;
-
-/**
- * @ODM\Document
- */
-class TreeSlug
-{
-    /**
-     * @ODM\Id
-     */
-    private $id;
-
-    /**
-     * @ODM\String
-     */
-    private $title;
-
-    /**
-     * @Gedmo\Slug(handlers={
-     *      @Gedmo\SlugHandler(class="Gedmo\Sluggable\Handler\TreeSlugHandler", options={
-     *          @Gedmo\SlugHandlerOption(name="parentRelationField", value="parent"),
-     *          @Gedmo\SlugHandlerOption(name="separator", value="/")
-     *      })
-     * }, separator="-", updatable=true, fields={"title"})
-     * @ODM\String
-     */
-    private $alias;
-
-    /**
-     * @ODM\ReferenceOne(targetDocument="TreeSlug")
-     */
-    private $parent;
-
-    public function setParent(TreeSlug $parent = null)
-    {
-        $this->parent = $parent;
-    }
-
-    public function getParent()
-    {
-        return $this->parent;
-    }
-
-    public function getId()
-    {
-        return $this->id;
-    }
-
-    public function setTitle($title)
-    {
-        $this->title = $title;
-    }
-
-    public function getTitle()
-    {
-        return $this->title;
-    }
-
-    public function getSlug()
-    {
-        return $this->alias;
-    }
-}