in sonata admin, we have this listener. not sure if the same could work for you too? its a lot less code than we have here - then again i did not follow it in detail. https://github.com/sonata-project/SonataDoctrinePhpcrAdminBundle/blob/master/Form/Listener/CollectionOrderListener.php