The popup window should list one item in the list
No items displayed in the list
Hi guys, I'm trying to implement m2m relationship but for some reason selecting items (browse) is not working - empty list is shown. When I've checked the API call that suppose to bring a list of items for selection I see the following error. I'm using the latest build version of API and App
UPDATE 1:
After brief investigation I've found that at the moment when createMetadataPagination method is called the $_GET is empty. Probably it caused by request query string that in my case was:limit=200&offset=0&meta=%2A&fields%5B0%5D=name&fields%5B1%5D=id&sort=name. Can it be that 'meta' query string param escaped by mistake?
UPDATE 2:
I've made a fix in line 1025 of RelationalTableGateway.php - I've added validation for case if $params['meta'] is undefined, and at least list is shown right now, though search is not working. But I'm not sure that fix should be done on API side...
So this is a new code:
$meta_param=explode(',',array_key_exists('meta', $params) ? $params['meta'] : "");
Instead of this one:
$meta_param=explode(',',$params['meta']);

@yarick2000 - I am not able to reproduce this error in neither local env nor live demo.
limit=200&offset=0&meta=%2A&fields%5B0%5D=name&fields%5B1%5D=id&sort=name
If this is the case then the meta param is already passed in the request[*]. Thus the undefined index is maybe not possible.
The screen recording will be really helpful for this case. As the issue is not reproducible based on the described steps.
@bjgajjar , here is a screen recording:


I think this is a problem - in Slim $_GET params are not available: https://stackoverflow.com/questions/8125064/slim-php-and-get-parameters
I think this $_GET should be replaced with this: $this::$container->get('request')->getQueryParams() (or getParams()), but not sure 100%. Though when I did this replacement things started to work as they should
in Slim $_GET params are not available
Hey @yarick2000 - Sorry but I disagree with you here. $_GET is a PHP variable which must available in all PHP frameworks. Slim is one of them. So it should work over there.
In fact, I tried to replicate it in the live demo too. But not able to replicate it. Can you please try to upgrade your system?
Though I am sending PR with replace the $_GET with
$this::$container->get('request')->getQueryParams()
for a code improvement.
But I think the latest version must resolve your issue.
As well as you can find your solution in https://github.com/directus/api/pull/1313 :)
Hi @bjgajjar , thank you for reviewing this. I just have a small comment - if you've decided to replace $_GET with this code, you probably have to replace it also in createEntriesMetadata() method as well. Those are only 2 places where $_GET used in this class.
@yarick2000 - You can find it here
Most helpful comment
Hi @bjgajjar , thank you for reviewing this. I just have a small comment - if you've decided to replace $_GET with this code, you probably have to replace it also in createEntriesMetadata() method as well. Those are only 2 places where $_GET used in this class.