PHPackages                             smartlabs/sonata-inline-relation-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. [Database &amp; ORM](/categories/database)
4. /
5. smartlabs/sonata-inline-relation-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

smartlabs/sonata-inline-relation-bundle
=======================================

Inline editing of complex associations (OneToMany/ManyToMany with pivot entities) in Sonata Admin list views

1.0.19(3mo ago)00MITPHPPHP ^8.2CI passing

Since Mar 10Pushed 3mo agoCompare

[ Source](https://github.com/smartlabsAT/sonata-inline-relation-bundle)[ Packagist](https://packagist.org/packages/smartlabs/sonata-inline-relation-bundle)[ Docs](https://github.com/smartlabsAT/sonata-inline-relation-bundle)[ RSS](/packages/smartlabs-sonata-inline-relation-bundle/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)Dependencies (6)Versions (30)Used By (0)

SonataInlineRelationBundle
==========================

[](#sonatainlinerelationbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/fdb2861155042637294f7ed24ef79e69eb58487de3b8dbf8a9eb422c54993bd4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d6172746c6162732f736f6e6174612d696e6c696e652d72656c6174696f6e2d62756e646c652e737667)](https://packagist.org/packages/smartlabs/sonata-inline-relation-bundle)[![Tests](https://github.com/smartlabsAT/sonata-inline-relation-bundle/actions/workflows/tests.yml/badge.svg)](https://github.com/smartlabsAT/sonata-inline-relation-bundle/actions)[![License](https://camo.githubusercontent.com/5596cc61862503a5ff491506ff6fe9d4e4f62d360ec8d48e6b994d0f15e00ba7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736d6172746c6162732f736f6e6174612d696e6c696e652d72656c6174696f6e2d62756e646c652e737667)](https://packagist.org/packages/smartlabs/sonata-inline-relation-bundle)[![PHP Version](https://camo.githubusercontent.com/962aced9b09d89716dbebf186ff899754a096ff1068b6b7988675c2d9fab9331/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c75652e737667)](https://php.net)

Overview
--------

[](#overview)

SonataInlineRelationBundle adds inline editing of complex associations (OneToMany / ManyToMany with pivot entities) directly in Sonata Admin list views. Instead of navigating to a separate edit page, administrators click a pencil icon to open a popover panel anchored to the trigger cell where they can edit pivot fields, reorder entries via drag-and-drop, add new relations with a searchable dropdown, and remove existing ones -- all persisted instantly via AJAX.

  **Category relations with drag-and-drop, radio &amp; checkbox** **Tag relations with number, text &amp; select fields**   [![Inline category editing with hierarchical search, drag-and-drop sorting, radio and checkbox pivot fields](docs/screenshot-categories.png)](docs/screenshot-categories.png) [![Inline tag editing with number, text and select pivot fields](docs/screenshot-tags.png)](docs/screenshot-tags.png) **Try it yourself:** Run the [example app](example/) with a single `docker compose up -d` — no existing project required.

Features
--------

[](#features)

- Display pivot-entity collections as a compact column in any Sonata Admin list view
- Edit pivot fields inline: checkbox, radio, text, number, and select controls
- Radio fields enforce exclusivity automatically (only one entry can be `true` at a time)
- Drag-and-drop reordering with automatic position persistence
- Add new relations through a Select2 search dropdown (with configurable filters)
- Remove existing relations with a Sonata-style confirmation dialog
- Configurable default values for new pivot entries
- Nullable `relation_field` for direct entity mapping (without a related entity)
- Custom search query builder support for complex search scenarios
- Bundle-level default configuration with per-field overrides
- Symfony Event Dispatcher integration for all write operations
- Full internationalization with EN and DE translations out of the box
- CSRF protection, IDOR prevention, XHR-only enforcement, and Sonata Admin access checks
- Real-time list cell updates without page reload
- No external JavaScript dependencies beyond jQuery and Select2 (both included in Sonata Admin)

Requirements
------------

[](#requirements)

DependencyVersionPHP^8.2Symfony^7.0Sonata Admin Bundle^4.0Doctrine ORM^3.0The bundle also requires `symfony/property-access` and `symfony/security-csrf`, which are typically already installed in any Symfony + Sonata Admin project.

Installation
------------

[](#installation)

### 1. Install the package

[](#1-install-the-package)

```
composer require smartlabs/sonata-inline-relation-bundle
```

### 2. Register the bundle

[](#2-register-the-bundle)

If Symfony Flex did not register it automatically, add it to `config/bundles.php`:

```
return [
    // ...
    Smartlabs\SonataInlineRelationBundle\SonataInlineRelationBundle::class => ['all' => true],
];
```

### 3. Import routes

[](#3-import-routes)

Create `config/routes/sonata_inline_relation.yaml`:

```
sonata_inline_relation:
    resource: '@SonataInlineRelationBundle/Resources/config/routing.php'
```

Or as a PHP configurator (`config/routes/sonata_inline_relation.php`):

```
