doctrine / DoctrineFixturesBundle

Symfony integration for the doctrine/data-fixtures library
MIT License
2.47k stars 204 forks source link

SF4 and ODM #229

Closed lucalbert closed 6 years ago

lucalbert commented 6 years ago

Hello,

When I install the package on an SF4 application with ODM, I get this error message when removing the cache:

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!  In DoctrineExtension.php line 85:
!!
!!    To configure the ORM layer, you must first install the doctrine/orm package
!!    .
!!
!!
!!

Then no more console commands work and always return the same error.

My composer.json file is this one :

{
    "name": "project/app",
    "type": "project",
    "license": "proprietary",
    "description": "Web application",
    "minimum-stability": "beta",
    "require": {
        "php": "^7.1.3",
        "alcaeus/mongo-php-adapter": "^1.1",
        "doctrine/mongodb-odm-bundle": "^3.4",
        "sensio/framework-extra-bundle": "^5.0",
        "symfony/config": "^4.0@RC",
        "symfony/console": "^4.0",
        "symfony/flex": "^1.0",
        "symfony/form": "^4.0@RC",
        "symfony/framework-bundle": "^4.0",
        "symfony/lts": "^4@dev",
        "symfony/profiler-pack": "^1.0",
        "symfony/security-csrf": "^4.0@RC",
        "symfony/translation": "^4.0@RC",
        "symfony/twig-bridge": "^4.0@RC",
        "symfony/twig-bundle": "^4.0@beta",
        "symfony/validator": "^4.0@RC",
        "symfony/web-server-bundle": "^4.0@RC",
        "symfony/yaml": "^4.0"
    },
    "require-dev": {
        "codeception/codeception": "^2.3@dev",
        "doctrine/doctrine-fixtures-bundle": "^3.0",
        "friendsofphp/php-cs-fixer": "^2.8",
        "symfony/dotenv": "^4.0"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "provide": {
        "ext-mongo": "1.6.14"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "id": "01BZFD9KGWPA6MTBRR95TDJ3AR",
            "allow-contrib": true
        }
    }
}

Thank you

alcaeus commented 6 years ago

This bundle does ORM fixtures only. ODM fixture handling is in doctrine/mongodb-odm-bundle: https://github.com/doctrine/DoctrineMongoDBBundle/blob/master/Command/LoadDataFixturesDoctrineODMCommand.php

trq commented 6 years ago

Any ideas why there is no documentation about this? How do I get dependency injection working with my fixtures? Seems straight forward in the orm fixtures here

lokhman commented 6 years ago

@trq If you first run composer req doctrine/data-fixtures, then doctrine:mongodb:fixtures:load command will be available straightaway.

Fixtures documentation is here: https://github.com/doctrine/data-fixtures.

gustawdaniel commented 4 years ago

I have error

The given 'driver' mongodb is unknown, Doctrine currently supports only the following dr  
  ivers: pdo_mysql, pdo_sqlite, pdo_pgsql, pdo_oci, oci8, ibm_db2, pdo_sqlsrv, mysqli, dri  
  zzle_pdo_mysql, sqlanywhere, sqlsrv   

After removing this bundle I have

php bin/console doctrine:fixtures:load --fixtures=src/DataFixtures/

  There are no commands defined in the "doctrine:fixtures" namespace.                       

  Did you mean one of these?                                                                
      doctrine                                                                              
      doctrine:mongodb                                                                      
      doctrine:mongodb:cache                                                                
      doctrine:mongodb:fixtures                                                             
      doctrine:mongodb:generate                                                             
      doctrine:mongodb:mapping                                                              
      doctrine:mongodb:schema                                                               

  You may be looking for a command provided by the "DoctrineFixturesBundle" which is curre  
  ntly not installed. Try running "composer require doctrine/doctrine-fixtures-bundle --de  
  v".                                                                                       

But in case of

./bin/console doctrine:mongodb:fixtures:load

I see

 [ERROR] Could not find any fixture services to load.                                        
alcaeus commented 4 years ago

Please create a separate issue instead of reviving an old, resolved issue. Thanks.