PHPackages                             mikeevstropov/sortable-tree-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. mikeevstropov/sortable-tree-bundle

AbandonedArchivedSymfony-bundle[Admin Panels](/categories/admin)

mikeevstropov/sortable-tree-bundle
==================================

Offers a sortable feature for your Symfony2/3 admin tree listing

v1.1(9y ago)253.1k↓49.2%2[2 issues](https://github.com/mikeevstropov/mevSortableTreeBundle/issues)MITPHPPHP &gt;=5.3.0

Since Jul 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/mikeevstropov/mevSortableTreeBundle)[ Packagist](https://packagist.org/packages/mikeevstropov/sortable-tree-bundle)[ Docs](https://github.com/mikeevstropov/mevSortableTreeBundle)[ RSS](/packages/mikeevstropov-sortable-tree-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (5)Used By (0)

![Packagist](https://camo.githubusercontent.com/5c387736274a92690ee97436a6376a748e16be4975ee14526b66dfe7783279a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646f637472696e652f6f726d2e7376673f6d61784167653d32353932303030)

mevSortableTreeBundle
=====================

[](#mevsortabletreebundle)

Offers a sortable feature for your Symfony2/3 admin tree listing

[![screenshot](https://cloud.githubusercontent.com/assets/15070249/16892502/cd866138-4b3e-11e6-891d-02bf1ed4acac.png)](https://cloud.githubusercontent.com/assets/15070249/16892502/cd866138-4b3e-11e6-891d-02bf1ed4acac.png)

### Install requirements

[](#install-requirements)

**SonataAdminBundle**
\- the SonataAdminBundle provides a installation article here:

**Install and enable Tree Extension from [gedmo/doctrine-extensions](https://packagist.org/packages/gedmo/doctrine-extensions)**
\- nested behavior will implement the standard Nested-Set behavior on your Entity
(check [stof/doctrine-extensions-bundle](https://symfony.com/doc/master/bundles/StofDoctrineExtensionsBundle/index.html) for easier integration in your project)

### Installation

[](#installation)

```
composer require mikeevstropov/sortable-tree-bundle
```

### Configuration

[](#configuration)

Enable the **mevSortableTreeBundle** to your kernel:

```
// app/AppKernel.php

class AppKernel extends Kernel
{
	public function registerBundles()
	{
		$bundles = [
			// ...
			new Mev\SortableTreeBundle\MevSortableTreeBundle(),
		];
		// ...
	}
}
```

Include `MevSortableTreeBundle:SortableTree` to third service argument:

```
# app/config/services.yml

#   SonataAdminBundle Category
    admin.category:
        class: AppBundle\Admin\CategoryAdmin
        arguments:
            - ~
            - AppBundle\Entity\Category
            - 'MevSortableTreeBundle:SortableTree'
        tags:
            - { name: sonata.admin, manager_type: orm, label: Category }
```

Create new routes and the action field in Admin Class:

```
// src/AppBundle/Admin/CategoryAdmin.php

// ...

use Sonata\AdminBundle\Route\RouteCollection;

class CategoryAdmin extends AbstractAdmin
{
	// ...
	protected function configureRoutes(RouteCollection $collection)
	{
		$collection->add('up', $this->getRouterIdParameter().'/up');
        $collection->add('down', $this->getRouterIdParameter().'/down');
    }

    protected function configureFormFields(FormMapper $formMapper)
    {
        // create custom query to hide the current element by `id`

        $subjectId = $this->getRoot()->getSubject()->getId();
        $query = null;

        if ($subjectId)
        {
            $query = $this->modelManager
                ->getEntityManager('AppBundle\Entity\Category')
                ->createQueryBuilder('c')
                ->select('c')
                ->from('AppBundle:Category', 'c')
                ->where('c.id != '. $subjectId);
        }

        // ...
        $formMapper->add('parent', 'sonata_type_model', array(
            'query' => $query,
            'required' => false, // remove this row after the root element is created
            'btn_add' => false,
            'property' => 'name'
        ));
    }

	protected function configureListFields(ListMapper $listMapper)
	{
		// ...
		$listMapper->add('_action', null, array(
			'actions' => array(
				'up' => array(
                    'template' => 'MevSortableTreeBundle:Default:list__action_up.html.twig'
                ),
                'down' => array(
                    'template' => 'MevSortableTreeBundle:Default:list__action_down.html.twig'
                )
			)
		));
	}
}
```

Configure sort the list of models by `root` and `lft` fields:

```
// src/AppBundle/Admin/CategoryAdmin.php

// ...

class CategoryAdmin extends AbstractAdmin
{
	// ...
	public function createQuery($context = 'list')
	{
		$proxyQuery = parent::createQuery('list');
        // Default Alias is "o"
        // You can use `id` to hide root element
        // $proxyQuery->where('o.id != 1');
        $proxyQuery->addOrderBy('o.root', 'ASC');
        $proxyQuery->addOrderBy('o.lft', 'ASC');

		return $proxyQuery;
	}
	// ...
}
```

That's it!

### ToDo

[](#todo)

- Sortable behaveor for root elements (but, you can hide root element)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

4

Last Release

3616d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15070249?v=4)[mikeevstropov](/maintainers/mikeevstropov)[@mikeevstropov](https://github.com/mikeevstropov)

---

Top Contributors

[![mikeevstropov](https://avatars.githubusercontent.com/u/15070249?v=4)](https://github.com/mikeevstropov "mikeevstropov (38 commits)")[![pzaj2](https://avatars.githubusercontent.com/u/19946083?v=4)](https://github.com/pzaj2 "pzaj2 (1 commits)")

---

Tags

symfonysortabletreeadminsonata

### Embed Badge

![Health badge](/badges/mikeevstropov-sortable-tree-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mikeevstropov-sortable-tree-bundle/health.svg)](https://phpackages.com/packages/mikeevstropov-sortable-tree-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sonata-project/admin-bundle

The missing Symfony Admin Generator

2.2k19.5M314](/packages/sonata-project-admin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[pixassociates/sortable-behavior-bundle

Provides a way to sort your admin listing

481.6M5](/packages/pixassociates-sortable-behavior-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
