laminas-api-tools / api-tools-admin

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

Error during adding a RPC field - ZF3 #14

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

I have Zend 3 and Apigility 1.4, rwoverdijk/assetmanager 1.7 and I can't create a field to RPC endpoint.

After presing a save on field modal I get message "Field saved" and error:

76d13e21.vendor.js:5 Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: field in vm.rpc.fields, Duplicate key: string:<, Duplicate value: "<"
http://errors.angularjs.org/1.2.30/ngRepeat/dupes?p0=field%20in%20vm.rpc.fields&p1=string%3A%3C&p2=%22%3C%22
    at 76d13e21.vendor.js:3
    at 76d13e21.vendor.js:6
    at Object.d [as fn] (76d13e21.vendor.js:5)
    at k.$digest (76d13e21.vendor.js:5)
    at k.$apply (76d13e21.vendor.js:5)
    at i (76d13e21.vendor.js:4)
    at r (76d13e21.vendor.js:4)
    at XMLHttpRequest.w.onreadystatechange (76d13e21.vendor.js:4) 

Plus the field doesn't appear in list of fields.

EDIT: After further investigations I've added the following components:

composer require zendframework/zend-validator
composer require zendframework/zend-filter
composer require zendframework/zend-inputfilter
composer require zendframework/zend-code

Now the API: http://localhost/zend3/apigility/api/module/ApplicationApi/rpc/ApplicationApi-V1-Rpc-Encryption-Controller/input-filter returns: Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Unable to resolve service "FilterManager" 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

EDIT 2: I've added Zend\Filter into modules.config.php file and it started to work.

Seriously guys, can't we require crucial dependecies to Apigility composer? So people like me won't end up in the same configuraction issues? It's a killer for newbies..


Originally posted by @divix1988 at https://github.com/zfcampus/zf-apigility-admin/issues/371

wujekpiotr commented 3 years ago

Every time I have this error:

9e2f6fa1.vendor.js:5 Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: field in vm.rest.fields, Duplicate key: string:<, Duplicate value: "<"
http://errors.angularjs.org/1.2.32/ngRepeat/dupes?p0=field%20in%20vm.rest.fields&p1=string%3A%3C&p2=%22%3C%22
    at 9e2f6fa1.vendor.js:3
    at 9e2f6fa1.vendor.js:6
    at Object.d [as fn] (9e2f6fa1.vendor.js:5)
    at k.$digest (9e2f6fa1.vendor.js:5)
    at k.$apply (9e2f6fa1.vendor.js:5)
    at i (9e2f6fa1.vendor.js:4)
    at r (9e2f6fa1.vendor.js:4)
    at XMLHttpRequest.w.onreadystatechange (9e2f6fa1.vendor.js:4)

image

Help me, please! I can't add any field normally. I can't add any filter... I must refresh the page every time

I use:

"require": {
        "php": "^5.6 || ^7.0",
        "laminas-api-tools/api-tools": "^1.4",
        "laminas-api-tools/api-tools-documentation": "^1.3",
        "laminas/laminas-component-installer": "^1.1.1 || ^2.1.1",
        "laminas/laminas-development-mode": "^3.2",
        "laminas/laminas-zendframework-bridge": "^1.0"
    },
    "require-dev": {
        "laminas-api-tools/api-tools-admin": "^1.6",
        "laminas-api-tools/api-tools-asset-manager": "^1.2",
        "laminas/laminas-composer-autoloading": "^1.1.1 || ^2.1",
        "laminas/laminas-developer-tools": "^1.2.1",
        "laminas/laminas-test": "^2.6.1 || ^3.2",
        "roave/security-advisories": "dev-master",
        "zfcampus/zf-deploy": "^1.3"
    },
divix1988 commented 3 years ago

@wujekpiotr I think you are missing the dependencies like: Laminas validator, filter, inputfilter and code. On top of that check if you have Laminas\Filter in modules.config.php That's what used to work for me a while ago.

wujekpiotr commented 3 years ago

Thank you for response. I have added it:

"require": {
        "php": "^5.6 || ^7.0",
        "laminas-api-tools/api-tools": "^1.4",
        "laminas-api-tools/api-tools-documentation": "^1.3",
        "laminas/laminas-code": "^3.4",
        "laminas/laminas-component-installer": "^1.1.1 || ^2.1.1",
        "laminas/laminas-development-mode": "^3.2",
        "laminas/laminas-filter": "^2.9",
        "laminas/laminas-inputfilter": "^2.10",
        "laminas/laminas-validator": "^2.13",
        "laminas/laminas-zendframework-bridge": "^1.0"
    },

In modules.config I have Laminas\Filter already:

return [
    'Laminas\Db',
    'Laminas\Filter',
    'Laminas\Hydrator',
    'Laminas\InputFilter',
    'Laminas\Paginator',
    'Laminas\Router',
    'Laminas\Validator',
    'Laminas\ApiTools',
    'Laminas\ApiTools\Documentation',
    'Laminas\ApiTools\ApiProblem',
    'Laminas\ApiTools\Configuration',
    'Laminas\ApiTools\OAuth2',
    'Laminas\ApiTools\MvcAuth',
    'Laminas\ApiTools\Hal',
    'Laminas\ApiTools\ContentNegotiation',
    'Laminas\ApiTools\ContentValidation',
    'Laminas\ApiTools\Rest',
    'Laminas\ApiTools\Rpc',
    'Laminas\ApiTools\Versioning',
    'Application',
    'Api',
];

But it still doesn't work:( Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed...