This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ocramius
added a commit
that referenced
this pull request
Apr 3, 2014
sorry to necro this but I'm getting this error now. I can't work it out as I am only loading one module with bare bones app? here is my SM config from module.config.php in my module: (If i uncomment the lines in MyAuthStorage anon function, it works? (it doesn't throw error) 'service_manager' => array(
'abstract_factories' => array(
'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
'Zend\Log\LoggerAbstractServiceFactory',
),
'aliases' => array(
'translator' => 'MvcTranslator',
),
'factories'=>array(
'MyAuthStorage' => function($sm) {
$namespace = 'zf_tutorial';
$member = null; //
$sessionManager = null;
$id = null;
//if ($sm->get('MyAuthService')->hasIdentity()) {
//$id = "259aa0dd6cd9465e193e753c6dcf38c4";
//}
return new \Application\Model\MyAuthStorage(
'zf_tutorial',
$member,
$sessionManager,
"259aa0dd6cd9465e193e753c6dcf38c4"
);
},
'MyAuthService' => function($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$dbTableAuthAdapter = new Zend\Authentication\Adapter\DbTable\CredentialTreatmentAdapter($dbAdapter, 'users','username','password');
$authService = new \Application\Service\MyAuthService();
$authService->setAdapter($dbTableAuthAdapter);
$authService->setStorage($sm->get('MyAuthStorage'));
return $authService;
},
),
), Here is MyAuthStorage: <?php
namespace Application\Model;
use Zend\Authentication\Storage;
class MyAuthStorage extends Storage\Session
{
/**
* Sets session storage options and initializes session namespace object
*
* @param mixed $namespace
* @param mixed $member
* @param SessionManager $manager
*/
public function __construct($namespace = null, $member = null, SessionManager $manager = null, $id = null)
{
if ($id == null) {
$sid = hash('md5', date("Y-m-d"));
} else {
$sid = $id;
}
session_id($sid);
parent::__construct($namespace, $member, $manager);
}
public function setRememberMe($rememberMe = 0, $time = 1209600)
{
if ($rememberMe == 1) {
$this->session->getManager()->rememberMe($time);
}
}
public function forgetMe()
{
$this->session->getManager()->forgetMe();
}
public function setId($id)
{
$this->session->getManager()->setId($id);
}
} Here is MyAuthService: <?php
namespace Application\Service;
class MyAuthService extends \Zend\Authentication\AuthenticationService
{
/**
* Constructor
*
* @param Storage\StorageInterface $storage
* @param Adapter\AdapterInterface $adapter
*/
public function __construct(Storage\StorageInterface $storage = null, Adapter\AdapterInterface $adapter = null)
{
parent::__construct($storage, $adapter);
}
} And here is the error: File:
C:\wamp\www\zf2\app\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:918
Message:
Circular dependency for LazyServiceLoader was found for instance MyAuthStorage Again, apologies for the necro but I just can't grok it? Thank you in advance :) |
gianarb
pushed a commit
to zendframework/zend-modulemanager
that referenced
this pull request
May 15, 2015
gianarb
pushed a commit
to zendframework/zend-modulemanager
that referenced
this pull request
May 15, 2015
…ncy-tests-for-module-manager-init' Close zendframework/zendframework#5948
gianarb
pushed a commit
to zendframework/zend-modulemanager
that referenced
this pull request
May 15, 2015
…ncy-tests-for-module-manager-init' into develop Close zendframework/zendframework#5948 Forward Port zendframework/zendframework#5948
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Additional test #5651 to check for circular dependencies and make sure loading a module from another module does not end up in an infinite loop.