zfcampus / zf-apigility

BSD 3-Clause "New" or "Revised" License
258 stars 52 forks source link

Fatal error when injecting Apigility v1.4 into Zend Framework 3 #182

Closed divix1988 closed 7 years ago

divix1988 commented 7 years ago

I've juts included 4 new packages: zfcampus/zf-apigility, zfcampus/zf-apigility-admin, zfcampus/zf-development-mode and rwoverdijk/assetmanager (not sure why though but fair enough). After that the website displays this stack trace:


<br />
<b>Fatal error</b>:  Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Unable to resolve service &quot;InputFilterManager&quot; to a factory; are you certain you provided it during configuration?' in D:\RZECZY_ADAMA\_XAMPP\xampp-5.6\htdocs\zend3\vendor\zendframework\zend-servicemanager\src\ServiceManager.php:670
Stack trace:
#0 D:\RZECZY_ADAMA\_XAMPP\xampp-5.6\htdocs\zend3\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(746): Zend\ServiceManager\ServiceManager-&gt;getFactory('InputFilterMana...')
#1 D:\RZECZY_ADAMA\_XAMPP\xampp-5.6\htdocs\zend3\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(195): Zend\ServiceManager\ServiceManager-&gt;doCreate('InputFilterMana...')
#2 D:\RZECZY_ADAMA\_XAMPP\xampp-5.6\htdocs\zend3\vendor\zfcampus\zf-content-validation\src\ContentValidationListenerFactory.php(31): Zend\ServiceManager\ServiceManager-&gt;get('InputFilterMana...')
#3 D:\RZECZY_ADAMA\_XAMPP\xampp-5.6\htdocs\zend3\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(747):  in <b>D:\RZECZY_ADAMA\_XAMPP\xampp-5.6\htdocs\zend3\vendor\zendframework\zend-servicemanager\src\ServiceManager.php</b> on line <b>670</b><br />

EDIT: It turns up, that I needed another pacakge: Zend\InputFilter, after importing it via Composer and adding it into modules.config.php it started to show my previous website. I still can't see Administration Panel of Apigility after running: php public/index.php development enable.

michalbundyra commented 7 years ago

So what error you can see now? As I understand, previous error was caused because you didn't enable Zend\InputFilter module, correct?

divix1988 commented 7 years ago

@webimpress thanks for your reply. That is correct, atm I don't know how to access Apigility Administration Panel when I am in development enable mode. I can access things like: apigility/api/module/StatusLib which returns me some json, but that's about it. {"name":"StatusLib","namespace":"StatusLib","is_vendor":false,"rest":[],"rpc":[],"versions":[1],"default_version":1,"_links":{"self":{"href":"http:\/\/localhost\/zend3\/apigility\/api\/module\/StatusLib"},"authorization":{"templated":true,"href":"http:\/\/localhost\/zend3\/apigility\/api\/module\/StatusLib\/authorization{?version}"},"rest":{"templated":true,"href":"http:\/\/localhost\/zend3\/apigility\/api\/module\/StatusLib\/rest{?version}"},"rpc":{"templated":true,"href":"http:\/\/localhost\/zend3\/apigility\/api\/module\/StatusLib\/rpc{?version}"}}}

How is Apigility GUI triggered? Perhaphs I can force it to show with some other mode than dev? Somethig to note is that: I had my previous Module called: Application and now I've added apigility one: StatusLib, will that cause the problem?

EDIT: I've managed to figure out to install https://github.com/zfcampus/zf-apigility-admin-ui with all required dependecies. I am now able to access: apigility/ui, but the whole page is blank and it's throwing 404's for CSS, JS, I think it's due to bower install command, which is throwing: ENOENT No bower.json present How do I create a bower.json file?

michalbundyra commented 7 years ago

@divix1988 Please read the documentation: https://apigility.org/documentation/intro/updating-to-1-4#asset-management

In Apigility 1.4 asset management was changed. As you noted before you've installed rwoverdijk/assetmanager (I guess version 1.7). Do you have enabled this module? Do you have installed module zendframework/zend-component-installer? You can always try install this module, and than remove whole vendor directory and run composer update (or composer install) again. You can also try library zfcampus/zf-asset-manager instead of rwoverdijk/assetmanager, as described in the documentation. Both are fine and both should work with Apigility 1.4 :)

Definitely you don't need to run bower ;)

divix1988 commented 7 years ago

OMG finally!!... I've had to add AssetManager to development.config.php & dist (yeah I know this could easily be copied with development-enable script). and it started to work for anybody else who will struggle as me, here is a development.config.php modules list:

'modules' => [
    'ZF\Apigility\Admin',
    'ZF\Apigility\Admin\Ui',
    'ZF\Configuration',
    'AssetManager'
],

Thanks for your help @webimpress, big help! Dzięki! :)