symfony-cmf / media-bundle

UNMAINTAINED - Minimalistic interfaces to handle media in the context of the CMF
http://cmf.symfony.com/
30 stars 40 forks source link

Configuration Issue: "There is no extension able to load the configuration for cmf_media" #163

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi there! I'm trying to install this bundle in Symfony 2.8, but I have some problems with the configuration

I'm following the documentation and when I add "cmf_media.persistence.phpcr.enabled: true." to my config.yml file I get this error:

FileLoaderLoadException in FileLoader.php line 133: There is no extension able to load the configuration for "cmf_media" (in app/config/config.yml).

This is my composer.json: "require": { "php": ">=5.3.9", "symfony/symfony": "2.8.*", "doctrine/orm": "^2.4.8", "doctrine/doctrine-bundle": "~1.4", "symfony/swiftmailer-bundle": "~2.3", "symfony/monolog-bundle": "~2.11.3", "sensio/distribution-bundle": "~5.0", "sensio/framework-extra-bundle": "^3.0.2", "incenteev/composer-parameter-handler": "~2.0", "sonata-project/admin-bundle": "^3.9", "sonata-project/doctrine-orm-admin-bundle": "^3.1", "friendsofsymfony/user-bundle": "~2.0@dev", "egeloen/ckeditor-bundle": "^4.0", "vich/uploader-bundle": "^0.14.0", "symfony/finder": "^2.8", "symfony/filesystem": "^2.8", "jackalope/jackalope-doctrine-dbal": "^1.2", "doctrine/phpcr-bundle": "^1.3", "symfony-cmf/media-bundle": "^1.3" }

And my AppKernel.php: `<?php

use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new AppBundle\AppBundle(),

        // These are the other bundles the SonataAdminBundle relies on
        new Sonata\CoreBundle\SonataCoreBundle(),
        new Sonata\BlockBundle\SonataBlockBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),

        // And finally, the storage and SonataAdminBundle
        new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
        new Sonata\AdminBundle\SonataAdminBundle(),

        // FOS User bundle
        new FOS\UserBundle\FOSUserBundle(),

        // my bundles
        new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
        new Vich\UploaderBundle\VichUploaderBundle(),

        //For mediaBundle implementatation
        new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle()
    );

    if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }

    return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
    $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}

}`

Maybe I'm missing something? Some requirement? Or is config.yml not the location to enable phpcr?The truth is that documentation is a real mess

binhle410 commented 7 years ago

add this line to your AppKernel new Symfony\Cmf\Bundle\MediaBundle\CmfMediaBundle(),

ghost commented 7 years ago

Thank you very much for your answer!!

Now I got this error when enabling the bundle in AppKernel.php:

[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "Could not determine the Doctrine manager. Either Doctrine is not configured or a bundle is misconfigured.".

I got this in my config.yml

# Doctrine Configuration
doctrine:
   dbal:
        default_connection: default
         connections:
             default:
                 driver:   pdo_mysql
                 host:     "%database_host%"
                 port:     "%database_port%"
                 dbname:   "%database_name%"
                 user:     "%database_user%"
                 password: "%database_password%"
                 charset:  UTF8

     orm:
         auto_generate_proxy_classes: "%kernel.debug%"
         naming_strategy: doctrine.orm.naming_strategy.underscore
         auto_mapping: true
doctrine_phpcr:
     session:
         backend:
             type: doctrinedbal
             # connection: default

             # requires DoctrineCacheBundle
             # caches:
             #     meta: doctrine_cache.providers.phpcr_meta
             #     nodes: doctrine_cache.providers.phpcr_nodes
             # enable logging
             logging: true
             # enable profiling in the debug toolbar.
             profiling: true
         workspace: default
         username: admin
         password: admin

 cmf_media:
     persistence:
         phpcr:
             enabled: true

Through search I find this is because symfony doesn't know what doctrine connection needs to use: orm or phpcr (?)...I really don't understand very well how this works.

ghost commented 7 years ago

Ok, I found the origin of my problem...

I didn't install and configure "doctrine/phpcr-odm" and MediaBundle needs it. When installing phpcr, the documentation claims phpcr-odm to be optional...but if one wants to install mediabundle solo you NEED to install phpcr-odm.

ElectricMaxxx commented 7 years ago

@alisonlopez as long you do not enable phpcr as backend, you won't hit that issue, so phpcr-odm is optional. On the long way you should be able to use both backends in this bundle, so both doctrines are optional.