zfcampus / zf-apigility-admin

Admin API and UI for Apigility
BSD 3-Clause "New" or "Revised" License
90 stars 64 forks source link

Admin 1.5+ versioning issue (PSR-0 and PSR-4) #355

Closed michalbundyra closed 8 years ago

michalbundyra commented 8 years ago

It is not possible to create new version of the api using the admin panel. I've created new API (PSR-0 by default) and then I'm trying to create new version. I'm getting error:

Warning: Missing argument 1 for ZF\Apigility\Admin\Model\VersioningModel::getModuleVersions(),
called in /.../zf-apigility-skeleton/vendor/zfcampus/zf-apigility-admin/src/Controller/VersioningController.php on line 81
and defined in /.../zf-apigility-skeleton/vendor/zfcampus/zf-apigility-admin/src/Model/VersioningModel.php on line 103

It could be fixed by changes: Controller/VersioningControllerFactory.php:

13: -   use ZF\Apigility\Admin\Model\VersioningModelFactory;
13: +   use ZF\Apigility\Admin\Model\ModuleVersioningModelFactory;
...
25: -   return new VersioningController($container->get(VersioningModelFactory::class));
25: +   return new VersioningController($container->get(ModuleVersioningModelFactory::class));

But then we hit another issue:

Could not find source directory at path "/.../zf-apigility-skeleton/module/MyApi/src/MyApi/MyApi".
Make sure the directory exists and is writable.

And it could be resolved by removing: Model/ModuleVersioningModel.php:

447: -   if ($this->pathSpecType == ModulePathSpec::PSR_0) {
448: -       $srcPath .= DIRECTORY_SEPARATOR . $this->moduleName;
449: -   }

With these changes everything seems to be fine with PSR-0 modules.

Then I've tried with PSR-4 module, and with these changes I get error:

Could not find source directory at path "/.../zf-apigility-skeleton/module/MyApi/src/MyApi".
Make sure the directory exists and is writable.

So the same as above, although lines 447-449 are removed in Model/ModuleVersioningModel.php and variable $srcPath (line 445-446) already has wrong value: /.../zf-apigility-skeleton/module/MyApi/src/MyApi

I've finished on this, don't have more time to investigate more right now. Hope it helps resolve the issue.