I am sure you are right, thinking the same
The error is related to the column
book_book_author.book_id
in a where clause but i am not even seeing a “where” in the API JSON and only one reference to book_id which is in the initial query
<?php
require('../../dmxConnectLib/dmxConnect.php');
$app = new \lib\App();
$app->define(<<<'JSON'
{
"meta": {
"$_GET": [
{
"type": "text",
"name": "sort"
},
{
"type": "text",
"name": "dir"
}
]
},
"exec": {
"steps": {
"name": "query",
"module": "dbconnector",
"action": "select",
"options": {
"connection": "db",
"sql": {
"type": "SELECT",
"columns": [
{
"table": "book",
"column": "book_name"
}
],
"table": {
"name": "book"
},
"primary": "book_id",
"joins": [],
"query": "SELECT book_name\nFROM book",
"params": [],
"sub": {
"book_author": {
"type": "SELECT",
"table": {
"name": "book_book_author",
"alias": "book_author"
},
"key": "book_id",
"columns": [
{
"table": "book_author",
"column": "author_id"
},
{
"table": "author",
"column": "author_name"
}
],
"joins": [
{
"table": "author",
"column": "*",
"type": "INNER",
"clauses": {
"condition": "AND",
"rules": [
{
"table": "author",
"column": "author_id",
"operator": "equal",
"value": {
"table": "book_author",
"column": "author_id",
"type": "number"
},
"operation": "="
}
]
},
"primary": "author_id"
}
],
"query": "SELECT book_author.author_id, author.author_name\nFROM book_book_author AS book_author\nINNER JOIN author ON (author.author_id = book_author.author_id)",
"params": []
}
}
}
},
"output": true,
"meta": [
{
"type": "text",
"name": "book_name"
},
{
"name": "book_author",
"type": "array",
"sub": [
{
"type": "number",
"name": "author_id"
},
{
"type": "text",
"name": "author_name"
}
]
}
],
"outputType": "array"
}
}
}
JSON
);
?>