mangelsnc / adr-blog

📓 Demo project for ADR talk
9 stars 4 forks source link

Errors on composer install, missing dependencies in composer.json #2

Open akserikawa opened 5 years ago

akserikawa commented 5 years ago
!!  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineBundle" from namespace "Doctrine\Bundle\DoctrineBundle".
...
!!  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DoctrineCacheBundle" from namespace "Doctrine\Bundle\DoctrineCacheBundle".

Solved by adding the following packages to composer.json

composer require doctrine/orm
composer require doctrine/doctrine-cache-bundle
composer require doctrine/doctrine-bundle
composer require doctrine/doctrine-migrations-bundle

Also, composer install throws another error due to symfony/flex version being outdated

akserikawa commented 5 years ago

When running php bin/console doctrine:migrations:migrate it says:

PHP Fatal error:  Class 'Doctrine\DBAL\Migrations\AbstractMigration' not found in /Users/myuser/Sites/adr-blog/src/Migrations/Version20180526152815.php on line 11

Solved by changing:

# in src/Migrations/Version20180526152815.php

- use Doctrine\DBAL\Migrations\AbstractMigration;
+ use Doctrine\Migrations\AbstractMigration;

btw, my composer.json:

{
    "require": {
        "php": "^7.1.3",
        "ext-iconv": "*",
        "doctrine/doctrine-bundle": "^1.10",
        "doctrine/doctrine-cache-bundle": "^1.3",
        "doctrine/doctrine-migrations-bundle": "^2.0",
        "doctrine/orm": "^2.6",
        "symfony/console": "^4.0",
        "symfony/flex": "^1.0",
        "symfony/framework-bundle": "^4.0",
        "symfony/lts": "^4@dev",
        "symfony/phpunit-bridge": "^4.0",
        "symfony/yaml": "^4.0"
    },
    "require-dev": {
        "symfony/dotenv": "^4.0",
        "symfony/web-server-bundle": "^4.0"
    },
    // ...
}
akserikawa commented 5 years ago

Managed to run the project after a bit of hussle.

I had to install the following:

composer require symfony/serializer
composer require symfony/property-access

It all works fine for now!