idct / adminata-admin-mongodb-bundle
Doctrine MongoDB ODM storage layer for adminata, under the IDCT\Adminata\DoctrineMongoDB namespace. A hard fork of sonata-project/doctrine-mongodb-admin-bundle, which it conflicts with.
Package info
github.com/ideaconnect/adminata-admin-mongodb-bundle
Type:symfony-bundle
pkg:composer/idct/adminata-admin-mongodb-bundle
Requires
- php: ^8.4
- ext-mongodb: *
- doctrine/collections: ^2.0
- doctrine/mongodb-odm: ^2.6
- doctrine/mongodb-odm-bundle: ^5.0
- doctrine/persistence: ^4.0
- idct/adminata: dev-main
- symfony/config: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/doctrine-bridge: ^7.4 || ^8.0
- symfony/form: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/property-access: ^7.4 || ^8.0
- twig/twig: ^3.0
Requires (Dev)
- doctrine/data-fixtures: ^2.0
- friendsofphp/php-cs-fixer: ^3.95
- infection/infection: ^0.33.1
- matthiasnoback/symfony-config-test: ^6.1
- matthiasnoback/symfony-dependency-injection-test: ^6.2
- phpstan/extension-installer: ^1.1
- phpstan/phpdoc-parser: ^1.0
- phpstan/phpstan: ^1.0 || ^2.0
- phpstan/phpstan-phpunit: ^1.0 || ^2.0
- phpstan/phpstan-strict-rules: ^1.0 || ^2.0
- phpstan/phpstan-symfony: ^1.0 || ^2.0
- phpunit/phpunit: ^11.5.38 || ^12.3.10
- rector/rector: ^1.1 || ^2.0
- symfony/browser-kit: ^7.4 || ^8.0
- symfony/css-selector: ^7.4 || ^8.0
- symfony/dom-crawler: ^7.4 || ^8.0
- symfony/panther: ^2.4
- symfony/security-acl: ^3.3.4
- symfony/twig-bridge: ^7.4 || ^8.0
Suggests
None
Provides
None
Conflicts
Replaces
None
README
Doctrine MongoDB ODM persistence backend for Adminata — full
CRUD, filtering, sorting, pagination, exports and ACL management for MongoDB
documents, the same way
idct/adminata-doctrine-orm-admin-bundle provides it for relational
databases.
7.0: adminata's own names. Since 2026-09-12 this package is
idct/adminata-admin-mongodb-bundle(repository ideaconnect/adminata-admin-mongodb-bundle; the old address redirects) under theIDCT\Adminata\DoctrineMongoDB\namespace, built on adminata'sIDCT\Adminata\. The6.xline keeps the old package name and the Sonata-named adminata;5.xis the last line built onsonata-project/admin-bundle. Upgrading: UPGRADE-7.0.md and adminata's UPGRADE.md.
🚨 6.0 moved to adminata, 7.0 to adminata's names
6.0 is built against idct/adminata, not
sonata-project/admin-bundle. adminata is our hard fork of the Sonata Admin
stack with the Twig templates, CSS and JavaScript replaced by a Tailwind CSS v4
/ TailAdmin interface: Bootstrap, AdminLTE and jQuery are gone, and there is
no compatibility layer for them. If your project styles admin screens with
Bootstrap class names or scripts them with jQuery, that markup stops working
and has to be ported once.
7.0 takes adminata's own names. The namespace is
IDCT\Adminata\DoctrineMongoDB\, the bundle class AdminataDoctrineMongoDBBundle,
the configuration root adminata_doctrine_mongodb, the Twig namespace
@AdminataDoctrineMongoDB, and every service id starts with adminata.; the
package is idct/adminata-admin-mongodb-bundle and it conflicts with
sonata-project/doctrine-mongodb-admin-bundle rather than living beside it.
The map, and the tool that applies it to an application:
adminata's UPGRADE.md;
this package's rows: UPGRADE-7.0.md.
Adminata is still in development: idct/adminata
is on Packagist as dev-main only, and that is the constraint this release
requires it at. Both packages install from Packagist; no repositories entry
is needed.
Staying on Sonata Admin 4.x? Use the 5.x line. It is the last release
series built against sonata-project/admin-bundle and it keeps working.
🚨 This is a HARD FORK
idct/adminata-admin-mongodb-bundle is a hard fork of
sonata-project/doctrine-mongodb-admin-bundle,
not a soft fork or a temporary patch:
- The vendor name and Composer package id are different
(
idct/...vs.sonata-project/...) — the two cannot be installed side by side: 7.0 declares aconflictwith the upstream package, and noreplace. - The
5.xline already breaks BC in places upstream has not:ModelManager::getDocumentManager()is private,ProxyQuery::__call()is gone,ProxyQuery::setOptions()is removed,ModelFilter::fixIdentifier()rejects malformed input,Pager::countResults()throws when uninitialized, and more. See UPGRADE-5.0.md for the full break list. - Future releases will keep diverging — extending the public API, replacing parts that aren't worth keeping, dropping things upstream still ships. Upstream changes are pulled in selectively, not merged.
- We do not sync release numbers with upstream. Our
5.0.0is the fork's first release; the upstream lineage we forked from is 4.12.0.6.0.0is the move to Adminata, described above.
If you need exact upstream behaviour, stay on
sonata-project/doctrine-mongodb-admin-bundle. If you want a modernised
base on PHP 8.4+ / Symfony 7.4+ and don't mind moving with us, this is
the right place.
The MIT license, Thomas Rabaix's original copyright, and every upstream contributor's attribution are preserved — see LICENSE and the 74-entry author roster in composer.json.
What this bundle does
Installs next to idct/adminata and provides every persistence-layer concern
it needs in order to drive an admin UI against a MongoDB collection:
- CRUD —
ModelManagerimplements every CRUD path Sonata calls (create,update,delete,find,findBy,findOneBy,batchDelete,reverseTransform). - Datagrids —
Pager+ProxyQuerywrap the ODMQueryBuilderto give Sonata's listing screens pagination, sorting and a count query routed throughCollection::countDocuments. - Filtering — twelve ready-to-use filter classes you can declare on an
admin:
String,Number,Boolean,Choice,Date,DateRange,DateTime,DateTimeRange,Id,Model(relations),Callback(escape hatch),Empty(null / missing field). String filter understandsEQUAL,NOT_EQUAL,CONTAINS,NOT_CONTAINS,STARTS_WITH,ENDS_WITHwith an optionalcase_sensitiveswitch and full regex-input escaping. - Type guessing — two
TypeGuessers map ODM mapping types (Type::STRING,Type::INT,Type::DATE, …) to Sonata column types and filter types automatically. - Builders —
DatagridBuilder,ListBuilder,ShowBuilderandFormContractormaterialise admin screens fromFieldDescriptions. - Exports —
DataSourceproduces a streaming\Iteratorfor Sonata's exporter; passhydrate: falsefor raw-array CSV/XML/JSON exports bypassing ODM hydration on wide collections. - ACLs —
ObjectAclManipulatorbulk-applies Symfony Security ACE entries to every document of an admin class, batched at 20 docs per flush with progress output. - Dotted paths —
FieldDescriptionFactoryresolves nested paths (author.publisher.name) against ODMClassMetadataand surfaces clear errors when a segment isn't actually an association.
If Adminata can do it for SQL via
idct/adminata-doctrine-orm-admin-bundle, this bundle is the piece that
lets you do the same for MongoDB.
Requirements
| Floor | Tested up to | |
|---|---|---|
| PHP | 8.4 | 8.5 |
| Symfony | 7.4 | 8.0 |
| Adminata | 1.0@dev | dev-main |
| Doctrine MongoDB ODM | 2.6 | latest 2.x |
| Doctrine MongoDB ODM Bundle | 5.0 | latest 5.x |
| Doctrine Persistence | 4.0 | latest 4.x |
| MongoDB server | 4.0+ | 7.x |
Both PHP 8.4 and PHP 8.5 are supported and exercised in CI. Symfony 7.4 (the current LTS) and 8.0 are the only supported Symfony lines.
Installation
Prerequisites
You should already have a Symfony 7.4+ application with Adminata and Doctrine MongoDB ODM Bundle installed — this bundle is the glue between them, not a replacement for either.
composer require idct/adminata:dev-main doctrine/mongodb-odm-bundle
Both come from Packagist. Adminata has no tagged release yet, so dev-main
is its only version there, and naming that constraint is what lets a project
with minimum-stability: stable take it.
Install
composer require idct/adminata-admin-mongodb-bundle
Symfony Flex registers the bundle automatically. If you're not using
Flex, add it to config/bundles.php manually:
return [ // ... IDCT\Adminata\DoctrineMongoDB\AdminataDoctrineMongoDBBundle::class => ['all' => true], ];
Declare an admin
Tag any admin service with manager_type: doctrine_mongodb and Adminata will
resolve it through this bundle's implementations:
// config/services.php (Symfony 7+ PHP config) $services->set(App\Admin\BookAdmin::class) ->tag('adminata.admin', [ 'manager_type' => 'doctrine_mongodb', 'model_class' => App\Document\Book::class, 'label' => 'Book', ]);
Optional bundle config
The bundle ships sane defaults; the only config tree it owns is per-type template overrides for list and show columns:
# config/packages/adminata_doctrine_mongodb.yaml adminata_doctrine_mongodb: templates: types: list: custom_type: '@App/admin/list_custom.html.twig' show: custom_type: '@App/admin/show_custom.html.twig'
Testing
The test suite has three layers:
- Pure unit tests — fast, no external services. Mock Sonata
interfaces and exercise our classes in isolation. Most of
tests/Builder/,tests/Filter/,tests/FieldDescription/. - Component tests — build an in-memory
DocumentManageragainst a real MongoDB server, persist fixtures, exercise full flows.PagerTest,ProxyQueryTest,ModelManagerTest's integration cases,ObjectAclManipulatorTest. - Functional tests — boot the test kernel
(
tests/App/AppKernel.php) and drive a real Sonata admin in a real browser via Symfony Panther.tests/Functional/.
Layers 2 and 3 need a MongoDB server. Layer 3 additionally needs a Firefox WebDriver.
The legacy-ui group is excluded by default. Those scenarios click through the
Bootstrap markup Adminata replaced, and they pass again once its milestones M3
and M4 rewrite the templates; vendor/bin/phpunit --group legacy-ui shows where
that stands.
Quick start (recommended)
docker compose up -d
PANTHER_SELENIUM_HOST=http://127.0.0.1:4444/wd/hub make test
docker-compose.yml brings up:
- a
mongo:latestcontainer on port27017 - a
selenium/standalone-firefox:latestSelenium Grid on port4444
Selenium also exposes noVNC at http://127.0.0.1:7900 (password secret)
if you want to watch the browser drive the suite.
Running individual layers
make test # full suite (needs MongoDB + Firefox) vendor/bin/phpunit tests/Builder # unit tests only vendor/bin/phpunit tests/Functional # functional tests only make coverage # produces build/logs/clover.xml
Local without docker
If you already have MongoDB and a non-snap Firefox + geckodriver on
your PATH, leave PANTHER_SELENIUM_HOST unset:
make test
Panther will start its own Firefox process. This is the path GitHub
Actions uses — see .github/workflows/test.yaml.
Quality gates
The CI workflow runs four gates; matching commands run locally as:
make test # PHPUnit vendor/bin/phpstan --no-progress --memory-limit=1G analyse vendor/bin/rector --no-progress-bar --dry-run make lint-php # PHP-CS-Fixer
All four must be green before a change can land — see AGENTS.md §7 for the definition of done.
Documentation
For the public API and configuration shape, the docs/ tree in this repository
(make docs); upstream Sonata's documentation for the package this one forked
describes the same design under the old names:
docs.sonata-project.org/projects/SonataDoctrineMongoDBAdminBundle.
Fork-specific material:
- AGENTS.md — architectural overview, where each piece lives, how it fits next to adminata, contribution rules.
- UPGRADE-7.0.md — 6.x → 7.0: adminata's own names.
- UPGRADE-6.0.md — 5.x → 6.0: the move to adminata.
- UPGRADE-5.0.md — 4.x → 5.0 break list (per-class).
- CHANGELOG.md — per-release notes.
Support
For bugs or feature ideas in this fork, open an issue on the fork's repository.
For questions about the admin bundle itself, adminata's repository is the place: https://github.com/ideaconnect/adminata.