New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 steps relations? #21
Comments
Is that really the result? That is worrying as it is not even valid JSON. Can you confirm this? How did you get this result? Please provide as much details as possible. |
Yep I have the same issue @mevdschee. I have a db as this model: If I want to read one row of "RezeptMischungen", I have this structure by your api: Formated image of the return of your api: My call of your api: Which is generally ok, but the table "Rezepte" has a relation to "Basen" which isn't applicated. Attached I send you my sql dump. Hope thats detailed enough inout for your debugging. |
Thank you very much! I will look into this and report back after reproducing your findings. |
Does this help?
And why do you get the table name both in mixed and in lower case? I can not reproduce that bug |
I really don't know why. Could be a collation problem I guess. I will cross check that and your solution tomorrow. Thanks for you effort! :) |
Okay, your contribution is much appreciated. You are probably running MySQL on Windows, right? |
Oh no. Im running mysql within XAMPP under OSX El Capitan. I can check that with my external Apache with MySQL. But I created that DB with Navicat not PHPmyadmin. |
@Disane87 Thank you for your cooperation on this second bug. Please post the returned JSON on your machine and please also post the output of:
on my machine it is:
because:
see: https://dev.mysql.com/doc/refman/5.1/en/charset-collation-information-schema.html Your help is very valuable! |
Sorry my example wasn't the exact result. @Disane87 explains the same issue perfectly. I am using MySQL with XAMPP on Windows. |
@henninghall You can update your "api.php" with the latest version as I applied a fix. Please let me know whether or not it works for you (it should). |
@mevdschee It works brilliantly! Thanks a lot for keeping this api so great! |
@Disane87 Can you still help me to identify the other bug (with the casing) by sending the returned JSON and executing the SQL queries on your machine? I have no OSX to test on here. |
@mevdschee
Returned JSON with your updated api.php:
|
Ah.. thank you very much! Very unexpected to me!
Can you post the output of this SQL query as well? |
Sure :)
|
Thank you, I will prepare a new version tonight that should fix the bug. |
Thank you! :) |
The case sensitivity issue should also be fixed now. See: 7bd9919 |
Thanks, works now! |
I am trying to attach relation data which works great except when it is "relations relation". In the example it should be possible to use mysql_crud_api_tranform() to achieve this.
I want to achieve this:
{ "posts": [ { "id": "1", "post_tags": [ { "id": "1", "post_id": "1", "tag_id": "1", "tags": [ { "id": "1", "name": "funny" } ] }, { "id": "2", "post_id": "1", "tag_id": "2", "tags": [ { "id": "2", "name": "important" } ] } ], "comments": [ { "id": "1", "post_id": "1", "message": "great" }, { "id": "2", "post_id": "1", "message": "fantastic" } ], "user_id": "1", "category_id": "1", "categories": [ { "id": "1", "name": "anouncement" } ], "content": "blog started" } ] }
But the result is :
{ "posts": [ { "id": "1", "post_tags": [ { "id": "1", "post_id": "1", "tag_id": "1", }, { "id": "2", "post_id": "1", "tag_id": "2", "tags": [ { "id": "2", "name": "important" } ] } ], "comments": [ { "id": "1", "post_id": "1", "message": "great" }, { "id": "2", "post_id": "1", "message": "fantastic" } ], "user_id": "1", "category_id": "1", "categories": [ { "id": "1", "name": "anouncement" } ], "content": "blog started" } ] "tags": [ { "id": "1", "name": "funny" } ] }
Do you know why or how i can fix this? If anyone is achieving the expected result, please provide an example of how you use mysql_crud_api_tranform(). Thanks for a great api!
The text was updated successfully, but these errors were encountered: