symfony-cmf / cmf-sandbox

Base project for trying CMF components integration
http://cmf.symfony.com
Other
367 stars 140 forks source link

Problem loading fixtures #383

Closed oriolplns closed 7 years ago

oriolplns commented 7 years ago

I had been following ths instructions from the readme file to install sandbox.

Everything goes web until I try to load fixtures. After execute php bin/console -v doctrine:phpcr:fixtures:load I get error. I've tried usinf pdo_mysql and pdo_sqlite. This is the message I get:

..... loading [5] AppBundle\DataFixtures\PHPCR\LoadStaticPageData loading [21] AppBundle\DataFixtures\PHPCR\LoadRoutingData

[Doctrine\ODM\PHPCR\Exception\InvalidArgumentException]
Parent must be an object NULL given.

Exception trace: () at /home/oriol/w3/cmf/vendor/symfony-cmf/routing-bundle/src/Doctrine/Phpcr/Route.php:163 Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route->setPosition() at /home/oriol/w3/cmf/src/AppBundle/DataFixtures/PHPCR/LoadRoutingData.php:184 AppBundle\DataFixtures\PHPCR\LoadRoutingData->load() at /home/oriol/w3/cmf/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php:121 Doctrine\Common\DataFixtures\Executor\AbstractExecutor->load() at /home/oriol/w3/cmf/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php:69 Doctrine\Common\DataFixtures\Executor\PHPCRExecutor->Doctrine\Common\DataFixtures\Executor{closure}() at /home/oriol/w3/cmf/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php:76 Doctrine\Common\DataFixtures\Executor\PHPCRExecutor->execute() at /home/oriol/w3/cmf/vendor/doctrine/phpcr-bundle/Command/LoadFixtureCommand.php:172 Doctrine\Bundle\PHPCRBundle\Command\LoadFixtureCommand->execute() at /home/oriol/w3/cmf/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:264 Symfony\Component\Console\Command\Command->run() at /home/oriol/w3/cmf/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:892 Symfony\Component\Console\Application->doRunCommand() at /home/oriol/w3/cmf/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:228 Symfony\Component\Console\Application->doRun() at /home/oriol/w3/cmf/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:81 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/oriol/w3/cmf/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:130 Symfony\Component\Console\Application->run() at /home/oriol/w3/cmf/bin/console:29

doctrine:phpcr:fixtures:load [--fixtures [FIXTURES]] [--append] [--name [NAME]] [--no-initialize] [--session [SESSION]] [--dm [DM]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

dbu commented 7 years ago

this looks like you missed one step. i just removed the database and then did this:

php bin/console doctrine:database:create
php bin/console doctrine:phpcr:init:dbal --force
php bin/console doctrine:phpcr:workspace:create sandbox
php bin/console doctrine:phpcr:repository:init
php bin/console -v doctrine:phpcr:fixtures:load

the error looks to me like you missed the doctrine:phpcr:repository:init step.

oriolplns commented 7 years ago

Thank you David

I'm still having the same problem... I don't know what I'm doing wrong.

I'm using app/config/phpcr_doctrine_dbal.yml.dist file as app/config/phpcr.yml

In the step doctrine:phpcr:workspace:create sandbox I put default instead sandbox because if not I have this error:

Executing initializer: CmfRoutingBundle Executing initializer: CmfMenuBundle
[PHPCR\PathNotFoundException]
Item /cms/menu not found in workspace default

I've tried to change phpcr_workspace: default to sandbox but then I'm still having the first error loading fixtures...

I'm using PHP 7, I don't know if it's important in this case.

oriolplns commented 7 years ago

SOLVED

The problem was in parameters:

I had:

parameters:
    locale: en
    locales:
        - es
        - ca
        - fr

Now, I've added the default_locale in locales and works:

parameters:
    locale: en
    locales:
        - en
        - es
        - ca
        - fr