laminas-api-tools / api-tools

Laminas API Tools module for Laminas
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
37 stars 19 forks source link

Module(StatusLib) couldn't be initialized #84

Closed ALTAMASH80 closed 1 year ago

ALTAMASH80 commented 3 years ago

Bug Report

Q A
~1.4 api-tools
7.4 PHP
20.04 Ubuntu
^3.1.1 Laminas-MVC
84.0.2 Firefox

Summary

Hi, I've installed Laminas API Tool with a fresh installation of Laminas-MVC and installed the API tool via composer command. Open the admin tool from the browser and tried to create an API and it gave me an error. At first, I didn't understand what is the problem. Google it and found a problem reported before by someone in which he had mentioned something about directory structure. This is the link.

Current behavior

The directory structure presented in the link is different which is getting produced now. The directory structure which is getting produced on my machine is something like below. -module --StatusLib ----config ------module.config.php ----src ------StatusLib --------Module.php --------V1 ----------Rpc ----------Rest ----view

--Module.php

To view the service in the admin UI, if I manually give the reference in composer.json the service appears and use dump command it appears. But after that, if you go to create an APC service it again doesn't work and it gives error "Can't assign to property selected_version". "autoload": { "psr-4": { "Application\": "module/Application/src/", "StatusLib\": "module/StatusLib/" } },

How to reproduce

composer require should look like below "php": "^7.3", "laminas/laminas-component-installer": "^1.0 || ^2.1", "laminas/laminas-development-mode": "^3.2", "laminas/laminas-mvc": "^3.1.1", "laminas/laminas-cache": "^2.9.0", "laminas/laminas-db": "^2.10.0", "laminas/laminas-mvc-form": "^1.0", "laminas/laminas-json": "^3.1.2", "laminas/laminas-log": "^2.11", "laminas/laminas-mvc-i18n": "^1.1.1", "laminas/laminas-mvc-plugins": "^1.0.1", "laminas/laminas-psr7bridge": "^1.2.0", "laminas/laminas-session": "^2.9.1", "laminas/laminas-di": "^3.1.1", "laminas-api-tools/api-tools": "~1.4", "rwoverdijk/assetmanager": "^3.0", "psr/http-factory": "^1.0"

/path/to/laminas-mvc/config/module.config.php

'Laminas\\Paginator',
'Laminas\\Router',
'Laminas\\Validator',
'Laminas\\ApiTools\\Versioning',
'Laminas\\ApiTools\\ApiProblem',
'Laminas\\ApiTools\\ContentNegotiation',
'Laminas\\ApiTools\\Rpc',
'Laminas\\ApiTools\\MvcAuth',
'Laminas\\ApiTools\\Hal',
'Laminas\\ApiTools\\Rest',
'Laminas\\ApiTools\\ContentValidation',
'Laminas\\ApiTools',
'Laminas\\ApiTools\\Configuration',
'Laminas\\ApiTools\\Admin',
'AssetManager',
'Application',
'StatusLib',

config/development.config.php

    'Laminas\Di',
    'Laminas\Log',
    'Laminas\Db',
    'Laminas\Mvc\Plugin\FilePrg',
    'Laminas\Mvc\Plugin\FlashMessenger',
    'Laminas\Mvc\Plugin\Identity',
    'Laminas\Mvc\Plugin\Prg',
    'Laminas\Session',
    'Laminas\Mvc\I18n',
    'Laminas\Form',
    'Laminas\Hydrator',
    'Laminas\InputFilter',
    'Laminas\Filter',
    'Laminas\I18n',
    'Laminas\Cache',
    'Laminas\DeveloperTools',
    'Laminas\Diactoros',

Expected behavior

I should be able to create API services. Also, if possible please add doctrine configuration in the readme.MD file. Thanks!