Abhoryo / APYJsFormValidationBundle

This bundle performs validations of a form in javascript. (i18n compatible and several javascript frameworks supported)
92 stars 23 forks source link

Problem after installation #5

Closed AliHichem closed 12 years ago

AliHichem commented 12 years ago

When I try to visit a form that uses ths js validation I get this error:

Cannot redeclare class apy...\validationgrouplistener

Any idea ?

In fact I'm using the FosUserBundle

Abhoryo commented 12 years ago

I use FosUserBundle too.

This listener is configured once in the services.xml file. Do you load this same file in other place ? Or maybe you have another class called validationgrouplistener somewhere else

Can you give more information ? The whole error message or a debug trace ?

AliHichem commented 12 years ago

Do you load this same file in other place ? Or maybe you have another class called validationgrouplistener somewhere else. No I don't think so. When I dump the declared classes with the "APYJsFormValidationBundle" disabled, I don't find any "validationgrouplistener"..

I have these bundles installed :

    $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 Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
        new FOS\UserBundle\FOSUserBundle(),
        new MyApp\UserBundle\MyAppUserBundle(),
        new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
        new APY\JsFormValidationBundle\APYJsFormValidationBundle()
        );

Here is the full dump, hope it helps.

Fatal error: require(): Cannot redeclare class apy\jsformvalidationbundle\listener\validationgroupslistener in /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php on line 55

Call Stack: 0.0223 646360 1. {main}() /home/hichem/Desktop/MyApp/web/app_dev.php:0 0.5730 6435232 2. Symfony\Component\HttpKernel\Kernel->handle() /home/hichem/Desktop/MyApp/web/app_dev.php:24 0.6093 9105232 3. Symfony\Bundle\FrameworkBundle\HttpKernel->handle() /home/hichem/Desktop/MyApp/app/bootstrap.php.cache:547 0.6094 9106888 4. Symfony\Component\HttpKernel\HttpKernel->handle() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php:46 1.1530 26849664 5. Symfony\Component\HttpKernel\HttpKernel->handleException() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:77 1.1530 26851304 6. Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher->dispatch() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:174 1.1530 26851304 7. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php:118 1.1531 26852112 8. Symfony\Bundle\FrameworkBundle\Debug\TraceableEventDispatcher->doDispatch() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:49 1.1541 26869424 9. call_user_func() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:82 1.1541 26869480 10. Symfony\Component\HttpKernel\EventListener\ExceptionListener->onKernelException() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:0 1.1741 27115464 11. Symfony\Bundle\FrameworkBundle\HttpKernel->handle() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php:79 1.1742 27119864 12. Symfony\Component\HttpKernel\HttpKernel->handle() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php:46 1.1742 27119864 13. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:71 1.2680 28171216 14. Symfony\Component\HttpKernel\HttpKernel->filterResponse() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:139 1.2681 28172648 15. Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher->dispatch() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:157 1.2681 28172648 16. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php:118 1.2682 28172648 17. Symfony\Bundle\FrameworkBundle\Debug\TraceableEventDispatcher->doDispatch() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:49 1.2703 28206496 18. call_user_func() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:82 1.2703 28206552 19. Symfony\Component\HttpKernel\EventListener\ProfilerListener->onKernelResponse() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:0 1.2704 28206712 20. Symfony\Component\HttpKernel\Profiler\Profiler->collect() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php:95 1.2724 28482488 21. Symfony\Component\HttpKernel\DataCollector\EventDataCollector->collect() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/Profiler.php:174 1.2724 28487688 22. Symfony\Bundle\FrameworkBundle\Debug\TraceableEventDispatcher->getNotCalledListeners() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php:42 1.2724 28488000 23. Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher->getListeners() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:133 1.2726 28488232 24. Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher->lazyLoad() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php:97 1.2726 28488664 25. Symfony\Component\DependencyInjection\Container->get() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php:134 1.2726 28489304 26. appDevDebugProjectContainer->getJsfv_ValidationGroupsListenerService() /home/hichem/Desktop/MyApp/app/bootstrap.php.cache:190 1.2726 28489952 27. Symfony\Component\ClassLoader\DebugUniversalClassLoader->loadClass() /home/hichem/Desktop/MyApp/vendor/symfony/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php:0

Abhoryo commented 12 years ago

Have you call twice the JSFV() twig function in the same template ?

AliHichem commented 12 years ago

if fact, I didn't use "JSFV()" call yet. The error occurs in all routes (pages): when I try to visit any page I get the exception with no template.

I use symfony 2.0.7 with some extra bundles like doctrine extension and foruserbundle. I tried to disable come bundles/namespace call in my kernel/autoload to see if the problem is a conflict with another bundle but without success.

Here is my deps file:

[symfony] git=http://github.com/symfony/symfony.git version=v2.0.7

[twig] git=http://github.com/fabpot/Twig.git version=v1.4.0

[monolog] git=http://github.com/Seldaek/monolog.git version=1.0.2

[doctrine-common] git=http://github.com/doctrine/common.git version=2.1.4

[doctrine-dbal] git=http://github.com/doctrine/dbal.git version=2.1.5

[doctrine] git=http://github.com/doctrine/doctrine2.git version=2.1.4

[swiftmailer] git=http://github.com/swiftmailer/swiftmailer.git version=v4.1.3

[assetic] git=http://github.com/kriswallsmith/assetic.git version=v1.0.2

[twig-extensions] git=http://github.com/fabpot/Twig-extensions.git

[metadata] git=http://github.com/schmittjoh/metadata.git version=1.0.0

[SensioFrameworkExtraBundle] git=http://github.com/sensio/SensioFrameworkExtraBundle.git target=/bundles/Sensio/Bundle/FrameworkExtraBundle version=origin/2.0

[JMSSecurityExtraBundle] git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git target=/bundles/JMS/SecurityExtraBundle version=origin/1.0.x

[SensioDistributionBundle] git=http://github.com/sensio/SensioDistributionBundle.git target=/bundles/Sensio/Bundle/DistributionBundle version=origin/2.0

[SensioGeneratorBundle] git=http://github.com/sensio/SensioGeneratorBundle.git target=/bundles/Sensio/Bundle/GeneratorBundle

[AsseticBundle] git=http://github.com/symfony/AsseticBundle.git target=/bundles/Symfony/Bundle/AsseticBundle version=v1.0.1

[FOSUserBundle] git=git://github.com/FriendsOfSymfony/FOSUserBundle.git target=bundles/FOS/UserBundle

[gedmo-doctrine-extensions] git=git://github.com/l3pp4rd/DoctrineExtensions.git

[DoctrineExtensionsBundle] git=git://github.com/stof/StofDoctrineExtensionsBundle.git target=/bundles/Stof/DoctrineExtensionsBundle

[JMSTranslationBundle] git=https://github.com/schmittjoh/JMSTranslationBundle.git target=/bundles/JMS/TranslationBundle

[php-parser] git=https://github.com/nikic/PHP-Parser.git

[JsFormValidationBundle] git=git://github.com/Abhoryo/APYJsFormValidationBundle.git target=bundles/APY/JsFormValidationBundle

Regards

Abhoryo commented 12 years ago

I'll try your configuration.

Do you have the same error when your clear the cache ?

Abhoryo commented 12 years ago

Can you give me your config.xml.

AliHichem commented 12 years ago

Yes I tried to clear the cache but with no success.

Sorry, I do not use xml format for my configuration files. Here is my config.yml, but I think it's not very "readable" as a comment here:

imports:

framework:

esi: ~

#translator:      { fallback: %locale% }
secret:          %secret%
charset:         UTF-8
router:          { resource: "%kernel.root_dir%/config/routing.yml" }
form:            true
csrf_protection: true
validation:      { enable_annotations: true }
templating:      { engines: ['twig','php'] } #assets_version: SomeVersionScheme
session:
    default_locale: %locale%
    auto_start:     true
translator: { fallback: en }

Twig Configuration

twig: debug: %kernel.debug% strict_variables: %kernel.debug%

Assetic Configuration

assetic: debug: %kernel.debug% use_controller: false

java: /usr/bin/java

filters:
    cssrewrite: ~
    # closure:
    #     jar: %kernel.root_dir%/java/compiler.jar
    # yui_css:
    #     jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar

Doctrine Configuration

doctrine: dbal: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password% charset: UTF8

orm:
    auto_generate_proxy_classes: %kernel.debug%
    auto_mapping: true
    mappings:
        StofDoctrineExtensionsBundle: ~

Swiftmailer Configuration

swiftmailer: transport: %mailer_transport% host: %mailer_host% username: %mailer_user% password: %mailer_password%

jms_security_extra: secure_controllers: true secure_all_services: false

fos_user: db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel' firewall_name: main user_class: MyApp\UserBundle\Entity\User

stof_doctrine_extensions: default_locale: en_US orm: default: tree: true timestampable: true # not needed: listeners are not enabled by default

jms_translation:

configs:

app:

default_output_format: yml

dirs: [%kernel.root_dir%, %kernel.root_dir%/../src]

output_dir: %kernel.root_dir%/Resources/translations

ignored_domains: [routes]

excluded_names: [TestCase.php, Test.php]

excluded_dirs: [cache, data, logs]

extractors: [alias_of_the_extractor]

Abhoryo commented 12 years ago

Don't worry, I use the Edit button to have a plain text config.

Great I have another error : Fatal error: Cannot redeclare class APY\JsFormValidationBundle\Listener\ValidationGroupsListener in C:\var\www\Symfony\vendor\bundles\APY\JsFormValidationBundle\EventListener\ValidationGroupsListener.php on line 17

It's almost the same :D

Abhoryo commented 12 years ago

Since Symfony 2.0.5, we have these errors. Tomorrow I'll try to figure what changed in this version.

Abhoryo commented 12 years ago

I found the problem. Last time I've changed a directory name without update the namespace in included files. But I don't know why it was working with Symgony < 2.0.5 and not symfony >= 2.0.5.

You can download the last version. Thank you and sorry to waste your time.

AliHichem commented 12 years ago

Thanks for your help.