Open weierophinney opened 4 years ago
We have ticket #71 to fix the whole documentation for Session Manager (I think we should at least mention default factory we have in the package).
Also I'd like to point https://github.com/zendframework/zend-session/pull/61 where we made a change.
/cc @froschdesign
Originally posted by @michalbundyra at https://github.com/zendframework/zend-session/pull/124#issuecomment-544695940
@webimpress
I think we should at least mention default factory we have in the package
We must document the factory because this is the way the user should go. These manual configuration must be removed from all packages.
Originally posted by @froschdesign at https://github.com/zendframework/zend-session/pull/124#issuecomment-544699438
'service_manager' => [
'factories' => [
SaveHandlerInterface::class => SaveHandlerDbFactory::class,
SaveHandlerDbFactory::class => InvokableFactory::class,
]
]
namespace App\Session\SaveHandler;
use Interop\Container\ContainerInterface;
use Laminas\Db\Adapter\Adapter;
use Laminas\Db\TableGateway\TableGateway;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\Session\SaveHandler\DbTableGateway;
use Laminas\Session\SaveHandler\DbTableGatewayOptions;
class SaveHandlerDbFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
return new DbTableGateway(
new TableGateway( 'session', $container->get(Adapter::class)),
new DbTableGatewayOptions()
);
}
}
This best way inject?
Looks like the example code in
bootstrapSession()
expects to read a keysession
and notsession_manager
from the configuration.Provide a narrative description of what you are trying to accomplish:
Originally posted by @ekarakashi at https://github.com/zendframework/zend-session/pull/124