bjyoungblood / ZfcUserAcl

Glue between ZfcUser and ZfcAcl
1 stars 1 forks source link

CircularDependencyFoundException #2

Closed ghost closed 12 years ago

ghost commented 12 years ago

PHP Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\CircularDependencyFoundException' with message 'Circular dependency for LazyServiceLoader was found for instance ZfcUserAcl\Service\ZfcUserAclService' in vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:535

bjyoungblood commented 12 years ago

In order to debug this more easily, open up Zend\ServiceManager\ServiceManager. In the createServiceViaCallback method (around line 530, depending on which commit you're on). At the beginning of the method, var_dump($rname) and paste the results here.

ghost commented 12 years ago

string(13) "ModuleManager" string(12) "EventManager" string(36) "ZfcUserAcl\Service\ZfcUserAclService" string(14) "zfcacl_service" string(18) "ZfcAcl\Service\Acl" string(12) "EventManager" string(34) "ZfcUserAcl\Service\AclLoaderZendDb" string(27) "ZfcUserAcl\Model\RoleMapper" string(18) "zfcuseracl_role_tg" string(21) "zfcuseracl_db_adapter" string(23) "Zend\Db\Adapter\Adapter" string(20) "zfcuser_user_service" string(19) "zfcuser_user_mapper" string(2) "Di" string(13) "Configuration" string(36) "ZfcUserAcl\Service\ZfcUserAclService"

ghost commented 12 years ago

ZfcUserAcl\Service\ZfcUserAclService is registered twice ?

ghost commented 12 years ago

Issue is here:

https://github.com/bjyoungblood/ZfcUserAcl/blob/master/Module.php#L84

ghost commented 12 years ago

What to do with this config file: https://github.com/bjyoungblood/ZfcUserAcl/blob/master/config/module.config.php

Copy it into my autoload directory ?

bjyoungblood commented 12 years ago

This is an issue that I've frequently seen when using Zend\Di and Zend\ServiceManager simultaneously. I'm looking into it and getting nowhere slowly. For now, my best advice would be to use the ServiceManager instead of Zend\Di, if possible. That is obviously not a good solution though.

bjyoungblood commented 12 years ago

I did a small refactoring to eliminate the line that generated the exception. Try fff5ba044d42e71ce5f504beae4e0f9f2b29beca

ghost commented 12 years ago

Thanks, error does no exist anymore!