Install Armonic in an existing Symfony project

This guide assumes your Symfony project already works and has a configured database connection.
Before running migrations on a production database, make a backup.

1. Prepare your project

Move to your existing project root:

cd /path/to/your-symfony-project

If your project does not use Symfony Flex endpoints for Softspring recipes, configure them:

composer config --json extra.symfony.endpoint '["https://api.github.com/repos/softspring/recipes/contents/index.json",  "flex://defaults"]'

Because Armonic 6 currently uses development branches, configure Composer stability:

composer config minimum-stability dev
composer config prefer-stable true

2. Install Armonic

Install Armonic:

composer require softspring/armonic:6.0.x-dev -W

You can optionally install Softspring packages from source:

composer config 'preferred-install.softspring/*' source

3. Troubleshooting after install

If you get an error like:
Cannot autowire service "...DynamicTypesExtension"... TypeResolverInterface ... no such service exists
add this service definition to config/services.yaml:

services:
    Softspring\Component\DynamicFormType\Form\Resolver\TypeResolverInterface:
        class: Softspring\Component\DynamicFormType\Form\Resolver\ChainTypeResolver
        arguments:
            $resolvers:
                - '@Softspring\CmsBundle\Form\Resolver\AppTypeResolver'
                - '@Softspring\CmsBundle\Form\Resolver\CmsTypeResolver'

and then run:

bin/console cache:clear
composer dump-autoload

[!NOTE]
If bin/console doctrine:migrations:diff --namespace="DoctrineMigrations" fails with
Unknown column type "sfs_translation" requested, check that these bundles are enabled in config/bundles.php:

Softspring\TranslatableBundle\SfsTranslatableBundle::class => ['all' => true],
Softspring\Component\DynamicFormType\SfsDynamicFormTypeBundle::class => ['all' => true],

and ensure the DBAL type is registered in config/packages/doctrine.yaml:

doctrine:
    dbal:
        types:
            sfs_translation: Softspring\TranslatableBundle\Doctrine\Type\TranslationType

then run:

bin/console cache:clear

4. Run migrations

Run Armonic migrations:

bin/console doctrine:migrations:sync-metadata-storage -n
bin/console doctrine:migrations:migrate -n

If this is a fresh integration environment and migrations are inconsistent, you can reset the database:

bin/console doctrine:database:drop --if-exists --force
bin/console doctrine:database:create
bin/console doctrine:migrations:sync-metadata-storage -n
bin/console doctrine:migrations:migrate -n

Do not do this on environments with data you need to preserve.

5. Next steps

Once installed:

  1. Configure security for /admin access.
  2. Create an admin user.
  3. Open /admin/cms/pages/ and start creating content.