Hi everyone,
I am folllowing the tutorials “Getting Started with Laminas MVC Applications” and after completing the major steps to get a view, I have an error message:
**Fatal error** : Class Album\Module contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Laminas\ModuleManager\Feature\ConfigProviderInterface::getConfig) in **C:\xampp\htdocs\laminas-mvc-tutorial\module\Album\src\module.php** on line **11**
Here is my module.php file:
<?php
namespace Album;
// Add these import statements:
use Laminas\Db\Adapter\AdapterInterface;
use Laminas\Db\ResultSet\ResultSet;
use Laminas\Db\TableGateway\TableGateway;
use Laminas\ModuleManager\Feature\ConfigProviderInterface;
class Module implements ConfigProviderInterface
{
// getConfig() method is here
// Add this method:
public function getControllerConfig()
{
return [
'factories' => [
Controller\AlbumController::class => function($container) {
return new Controller\AlbumController(
$container->get(Model\AlbumTable::class)
);
},
],
];
}
// Add this method:
public function getServiceConfig()
{
return [
'factories' => [
Model\AlbumTable::class => function($container) {
$tableGateway = $container->get(Model\AlbumTableGateway::class);
return new Model\AlbumTable($tableGateway);
},
Model\AlbumTableGateway::class => function ($container) {
$dbAdapter = $container->get(AdapterInterface::class);
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Model\Album());
return new TableGateway('album', $dbAdapter, null, $resultSetPrototype);
},
],
];
}
}
I should have followed every step. So what?
As far as the section Modules is concerned, here is my contribution.
I’ve run into problems that I could solve on my own, adding <?php at the top of following files: module.php, module.config.php, AlbumController.php
In module.config.php addition to the existing file should be completed with use Laminas\Router\Http\Segment;