Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "This repository can be attached only to ORM sortable listener" error in Gedmo sortable?

When usieing StofDoctrineExtensions (which is a Symfony2 port of Gedmo Doctrine Extensions) Sortable behaviour I kept on getting this error:

This repository can be attached only to ORM sortable listener

Since I could not easily find the answer in official docs I'm leaving an answer here for future reference.

like image 641
ioleo Avatar asked Jan 19 '13 12:01

ioleo


1 Answers

You need to enable any listeners you are using. In this case, Sortable.

stof_doctrine_extensions:
    default_locale: en_US
    orm:
        default:
            sortable: true

For Symfony 4, add this configuration in /config/packages/stof_doctrine_extensions.yaml. For older versions of Symfony, add it to config.yml.

like image 86
emarref Avatar answered Nov 12 '22 22:11

emarref