The error code is LaminasServiceManagerExceptionServiceNotFoundException
File:
D:Projectsvalidationvendorlaminaslaminas-servicemanagersrcServiceManager.php:586
The error message is Unable to resolve service “LaminasDbAdapterAdapterInterface” to a factory; are you certain you provided it during configuration?
Module.php file:
<?php
namespace Album;
use LaminasDbAdapterAdapterInterface;
use LaminasDbResultSetResultSet;
use LaminasDbTableGatewayTableGateway;
use LaminasModuleManagerFeatureConfigProviderInterface;
class Module implements ConfigProviderInterface
{
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
public function getServiceConfig()
{
return [
'factories' => [
ModelAlbumTable::class => function($container) {
$tableGateway = $container->get(ModelAlbumTableGateway::class);
return new ModelAlbumTable($tableGateway);
},
ModelAlbumTableGateway::class => function ($container) {
$dbAdapter = $container->get(AdapterInterface::class);
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new ModelAlbum());
return new TableGateway('album', $dbAdapter, null, $resultSetPrototype);
},
],
];
}
public function getControllerConfig()
{
return [
'factories' => [
ControllerAlbumController::class => function($container) {
return new ControllerAlbumController(
$container->get(ModelAlbumTable::class)
);
},
],
];
}
}
module.config.php file:
<?php
namespace Album;
use LaminasRouterHttpSegment;
return [
'router' => [
'routes' => [
'album' => [
'type' => Segment::class,
'options' => [
'route' => '/album[/:action[/:id]]',
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
],
'defaults' => [
'controller' => ControllerAlbumController::class,
'action' => 'index',
],
],
],
],
],
'view_manager' => [
'template_path_stack' => [
'album' => __DIR__ . '/../view',
],
],
];
modules.config.php file:
<?php
/**
* List of enabled modules for this application.
*
* This should be an array of module namespaces used in the application.
*/
return [
'LaminasRouter',
'LaminasValidator',
'Application',
'Album',
];
The problem seems to be that the tutorial uses LaminasDb service that isnt there anymore in the modules.config.php file, the tutorial shows a modules.config.php file that is different than mine, I tried adding ‘LaminasDb’ there but this just results in a different error.