zfcampus / zf-apigility-admin

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

DB-Connected (MySQL) modify filters UI-problem #377

Open JTS-FIN-Nettitaivas opened 7 years ago

JTS-FIN-Nettitaivas commented 7 years ago

Fresh Apigility 1.4.1 installation.

  1. Create a new Database Connected service from a MySQL table (PDO)
  2. Try to modify automatically generated filters from admin UI
  3. Fails, nothing happens other than new errors in browser console "Error: k.filter.options is undefined" (Firefox)

I tracked this down to module/API_NAME/config/module.config.php, where in input_filter_specs validator fields are generated like this:

0 => [
                'name' => 'column_name',
                'required' => false,
                'filters' => [
                    0 => [
                        'name' => \Zend\Filter\StringTrim::class,
                    ],
                    1 => [
                        'name' => \Zend\Filter\StripTags::class,
                    ],
                ],

So, no options... I got this fixed by manually edition all the validator fields to this format:

0 => [
                'name' => 'column_name',
                'required' => false,
                'filters' => [
                    0 => [
                        'name' => \Zend\Filter\StringTrim::class,
                        'options' => [],
                    ],
                    1 => [
                        'name' => \Zend\Filter\StripTags::class,
                        'options' => [],
                    ],
                ],

Now UI for modifying filters works.

h3christophe commented 7 years ago

I have the same issue - In Firefox and Chrome The only way is to manually removed/edit the module.config.php file for that api

This is not happening for REST services that are not DB Connected

weierophinney commented 4 years ago

This repository has been closed and moved to laminas-api-tools/api-tools-admin; a new issue has been opened at https://github.com/laminas-api-tools/api-tools-admin/issues/11.