mevdschee / php-crud-ui

Single file PHP script that adds a UI to a PHP-CRUD-API project
MIT License
123 stars 55 forks source link

parameters object exists but not displaying #21

Closed milenh closed 7 years ago

milenh commented 7 years ago

Passing the url to api.php retrieves json object ok: screen shot 2017-03-06 at 1 46 15 am

I can see the $parameters variable populated with the database query correctly, but for some reason the content is not displayed in the table. I can't see the list:

screen shot 2017-03-06 at 1 45 16 am

If I manually type selector/list, I got it partially working:

screen shot 2017-03-06 at 1 47 45 am

However, trying to add or edit a record doesn't work.

screen shot 2017-03-06 at 1 48 52 am

mevdschee commented 7 years ago

Can you provide some more information? Any error/warning/notice messages emitted by "ui.php"?

milenh commented 7 years ago

There are no error messages. Is there a way I can enable a more deep debug level? What I did is really straightforward - just copied api.php and ui.php in the same dir (along with all github files they have). Edited the bottoms of files, so I can connect to my localhost DB and get the json to ui.php from api.php. All file permissions are 755, so it should be ok.

The url which I'm using to get the data into ui.php is using filler, but I get the same result without filter too. The url looks like this: http://localhost/php-crud-api/api.php/trucks?filter=client_id,eq,14

milenh commented 7 years ago

Ok, so I enabled error reporting and this is what comes out:

Warning: array_filter() expects parameter 1 to be array, boolean given in /var/www/html/php-crud-api/ui.php on line 116

Warning: array_map(): Argument #2 should be an array in /var/www/html/php-crud-api/ui.php on line 122

Warning: array_filter() expects parameter 1 to be array, null given in /var/www/html/php-crud-api/ui.php on line 122

Warning: implode(): Invalid arguments passed in /var/www/html/php-crud-api/ui.php on line 122

Also when I click on Edit a record, this one comes out:

Notice: Array to string conversion in /var/www/html/php-crud-api/ui.php on line 269

mevdschee commented 7 years ago

Thank you, that helps to analyze the problem.

milenh commented 7 years ago

btw, the css urls are missing "http(s)", so you might want to correct it :)

mevdschee commented 7 years ago

btw, the css urls are missing "http(s)", so you might want to correct it :)

Those are protocol relative urls. See: https://www.paulirish.com/2010/the-protocol-relative-url/

mevdschee commented 7 years ago

There recently was a bug introduced in a wrong merge. Can you update "ui.php" with the latest version and let me know whether or not that fixed the issue?

see: https://github.com/mevdschee/php-crud-ui/pull/20/commits/1f3b7c1f139b2f32412d591c718fe0876d52e905

NB: search for '$this->$properties' and replace with '$this->properties'.

milenh commented 7 years ago

I'm using already the latest version and the the line is already "$this->properties". The errors are still there.

ghost commented 7 years ago

This issue (or maybe only some of the listed errors) occurs 'cause currently no swagger information are provided as definition from the api.php. Therefore the left column and list of available tables is empty as shown in the screenshots.

Due to the missing defintion, no properties can be loaded. At least the two methods references and referenced return the boolen value false. The array methods around line 116/122 expect an empty array instead of the boolean. The php error from milenh already mentions that behavior.

Warning: array_filter() expects parameter 1 to be array, boolean given in /var/www/html/php-crud-api/ui.php on line 116

I've already described that issue in my pull request php-crud-api#208.

milenh commented 7 years ago

Following @appcrew bug report for api.php, I confirm updating the api.php (and ui.php) to the latest versions solved the problem.

mevdschee commented 7 years ago

Thank you for your feedback!