Download the PHP package dennispansegrau/pimcore-content-migration-bundle without Composer
On this page you can find all versions of the php package dennispansegrau/pimcore-content-migration-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dennispansegrau/pimcore-content-migration-bundle
More information about dennispansegrau/pimcore-content-migration-bundle
Files in dennispansegrau/pimcore-content-migration-bundle
Package pimcore-content-migration-bundle
Short Description A Pimcore bundle that generates Doctrine-like migrations for Documents, Assets, and Data Objects — allowing developers to export Pimcore content structures as executable migration scripts to fully rebuild environments from scratch.
License MIT
Informations about the package pimcore-content-migration-bundle
Compatibility: Pimcore 11 and above.
Pimcore Content Migrations Bundle
The Pimcore Content Migrations Bundle introduces a migration system — similar to Doctrine Migrations — for Documents, Assets, and Data Objects in Pimcore.
It allows developers to export Pimcore content structures as executable PHP migration scripts and rebuild entire environments from scratch, enabling consistent and reproducible deployments across development, staging, and production systems.
The generated migrations create only dummy dependencies — documents, assets, and data objects are included with their content, but without their dependencies or child elements.
📚 Table of Contents
- ✨ Features
- ⚙️ Installation
- 🧩 CLI Command
- 💻 Example
- 🧰 Configuration
- 🧩 Custom DataType handlers
- 🎨 Custom Twig templates
- 🧠 Notes
- 🧾 License
✨ Features
- Generates migration scripts for Pimcore Documents, Assets, and Data Objects
- Rebuilds complete content structures on any environment
- Integrates with version control and deployment workflows
⚙️ Installation
Install the bundle via Composer:
Add the bundle to your config/bundles.php:
🧰 Configuration
If you do not use doctrine migrations in your project yet, please add following to your config/config.yaml:
This defines where generated content migration files are stored.
You can also set a default namespace to avoid passing it every time:
When set, content:migration:create uses this namespace if none is provided.
🧩 CLI Command
| Name | Description |
|---|---|
| TYPE | The Pimcore element type (document, asset, or object) |
| ID | The ID of the Pimcore element to export |
| Option | Description |
|---|---|
--namespace |
The namespace for the generated migration class (falls back to pimcore_content_migration.default_namespace if set) |
--with-children |
Include all child elements (e.g., sub-documents or child objects) in the migration file |
--inline-wysiwyg |
Inline WYSIWYG field content directly into the migration instead of saving it in a separate HTML file |
💻 Example
This command creates a migration for the document with ID 1 and stores it in the namespace App\Migrations\Content.
🧩 Custom DataType handlers
If you use custom DataTypes (or hit "Unsupported object of class" errors), you can register your own stringifier handler to control how values are serialized in migrations.
Example handler:
Register it as a service (priority can be adjusted to run before the default handler):
🎨 Custom Twig templates
You can override the bundled Twig templates to adapt the generated migration code to your own style. The bundle reads template paths from configuration, so you can point to your own templates.
Example configuration:
When customizing templates, use the Twig helper pcmb_value_to_string to safely serialize Pimcore
objects and complex values into PHP code:
🧠 Notes
- Migrations are executable PHP scripts — they can be committed to your VCS and deployed alongside your code.
- Each migration is idempotent and can safely be executed multiple times.
- This bundle does not modify Pimcore’s database schema — it only manages content structures.
- You can organize different types of migrations (Documents, Assets, Objects) under separate namespaces if needed.
- Please review and test all generated migrations before committing them or running them in production environments.
🧾 License
This bundle is licensed under the MIT License.