Add database entries after bundle installation

37 Views Asked by At

I'm just looking for a way to further configure an application after the installation of a bundle.

Imagine you have an entity called Permission. I want to add a new permission entry to the database after installing the bundle.

Do you have any suggestions?

I already tried composer scripts, but composer will only execute scripts in the root compose.json, so that is no option...

Also keep in mind that I look for a way to execute a command, function, or whatever that could contain logic, so a SQL file to migration is not the solution. ;)

1

There are 1 best solutions below

0
Vincent On

You should take a look at flex and flex formulas. Here is a link: https://symfony.com/doc/current/setup/flex_private_recipes.html

As far as I know, it's the only way to do something "automatically" on bundle install. Still, the user will be prompted to ensure the package is trusted before executing it's recipe.