public function testSluggableMetadata()
 {
     $meta = $this->em->getClassMetadata('Mapping\\Fixture\\Xml\\Sortable');
     $config = $this->sortable->getConfiguration($this->em, $meta->name);
     $this->assertArrayHasKey('position', $config);
     $this->assertEquals('position', $config['position']);
     $this->assertArrayHasKey('groups', $config);
     $this->assertCount(3, $config['groups']);
     $this->assertEquals('grouping', $config['groups'][0]);
     $this->assertEquals('sortable_group', $config['groups'][1]);
     $this->assertEquals('sortable_groups', $config['groups'][2]);
 }
 public function __construct(EntityManager $em, ClassMetadata $class)
 {
     parent::__construct($em, $class);
     $sortableListener = null;
     foreach ($em->getEventManager()->getListeners() as $event => $listeners) {
         foreach ($listeners as $hash => $listener) {
             if ($listener instanceof SortableListener) {
                 $sortableListener = $listener;
                 break;
             }
         }
         if ($sortableListener) {
             break;
         }
     }
     if (is_null($sortableListener)) {
         throw new \Gedmo\Exception\InvalidMappingException('This repository can be attached only to ORM sortable listener');
     }
     $this->listener = $sortableListener;
     $this->meta = $this->getClassMetadata();
     $this->config = $this->listener->getConfiguration($this->_em, $this->meta->name);
 }