Database API error when query related data and the relationship name is on pascal case


#1

Hi

I have posted this issue on the .net sdk, but I think is more an API problem, when I query a table with a relationship and the relationship name is on pascal casing it fails on retrieve the data

the name of the relationship is “imagedetail_by_PostBase”, here is the request http://localhost:80/api/v2/LaGuiaApi/_table/postbase?related=imagedetail_by_PostBase

here is the response

{
“error”: {
“context”: null,
“message”: “The Response content must be a string or object implementing __toString(), “boolean” given.”,
“code”: 500,
“trace”: [
“0 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(15548): Symfony\Component\HttpFoundation\Response->setContent(false)”,
“1 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(15061): Illuminate\Http\Response->setContent(Array)”,
“2 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(15070): Symfony\Component\HttpFoundation\Response->__construct(Array, 200, Array)”,
“3 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\vendor\dreamfactory\df-core\src\Utility\ResponseFactory.php(155): Symfony\Component\HttpFoundation\Response::create(Array, 200, Array)”,
“4 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(17595): DreamFactory\Core\Utility\ResponseFactory::sendResponse(Object(DreamFactory\Core\Utility\ServiceResponse), NULL, NULL, ‘_table/postbase’)”,
“5 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(17553): DreamFactory\Http\Controllers\RestController->handleService(‘v2’, ‘LaGuiaApi’, ‘_table/postbase’)”,
“6 [internal function]: DreamFactory\Http\Controllers\RestController->handleGET(‘v2’, ‘LaGuiaApi’, ‘_table/postbase’)”,
“7 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(8842): call_user_func_array(Array, Array)”,
“8 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(8911): Illuminate\Routing\Controller->callAction(‘handleGET’, Array)”,
“9 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(8891): Illuminate\Routing\ControllerDispatcher->call(Object(DreamFactory\Http\Controllers\RestController), Object(Illuminate\Routing\Route), ‘handleGET’)”,
“10 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“11 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9553): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“12 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(17848): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“13 [internal function]: DreamFactory\Http\Middleware\AccessCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“14 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“15 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“16 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9535): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“17 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(8892): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
“18 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(8877): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(DreamFactory\Http\Controllers\RestController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), ‘handleGET’)”,
“19 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(7831): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), ‘DreamFactory\\Ht…’, ‘handleGET’)”,
“20 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(7802): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))”,
“21 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(7455): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))”,
“22 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“23 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9553): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“24 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“25 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9535): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“26 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(7456): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
“27 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(7444): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))”,
“28 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(7429): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))”,
“29 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(2304): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))”,
“30 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))”,
“31 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9553): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“32 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\vendor\barryvdh\laravel-cors\src\HandleCors.php(43): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“33 [internal function]: Barryvdh\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“34 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“35 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(17932): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“36 [internal function]: DreamFactory\Http\Middleware\FirstUserCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“37 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“38 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(12881): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“39 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“40 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“41 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(11504): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“42 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“43 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“44 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(12622): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“45 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“46 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“47 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(12561): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“48 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“49 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“50 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(2978): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“51 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“52 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9545): call_user_func_array(Array, Array)”,
“53 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“54 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(9535): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“55 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(2251): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
“56 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\bootstrap\cache\compiled.php(2234): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))”,
“57 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\public\index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))”,
“58 {main}”
]
}
}

here is the schema of the table

{
“name”: “postbase”,
“is_view”: false,
“label”: “Postbase”,
“plural”: “Postbases”,
“description”: null,
“alias”: null,
“field”: [
{
“name”: “Oid”,
“label”: “Oid”,
“description”: null,
“type”: “string”,
“db_type”: “char(38)”,
“length”: 38,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: true,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: true,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “TypeOfObject”,
“label”: “TypeOfObject”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(100)”,
“length”: 100,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “Name”,
“label”: “Name”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(100)”,
“length”: 100,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “OptimisticLockField”,
“label”: “OptimisticLockField”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “GCRecord”,
“label”: “GCRecord”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: true,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “ObjectType”,
“label”: “ObjectType”,
“description”: null,
“type”: “reference”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: true,
“is_unique”: false,
“is_index”: true,
“ref_table”: “xpobjecttype”,
“ref_fields”: “OID”,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “Description”,
“label”: “Description”,
“description”: null,
“type”: “text”,
“db_type”: “text”,
“length”: null,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “Address”,
“label”: “Address”,
“description”: null,
“type”: “text”,
“db_type”: “longtext”,
“length”: null,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “Lat”,
“label”: “Lat”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(100)”,
“length”: 100,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “Lon”,
“label”: “Lon”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(100)”,
“length”: 100,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: false,
“is_unique”: false,
“is_index”: false,
“ref_table”: null,
“ref_fields”: null,
“picklist”: null,
“validation”: null,
“alias”: null
},
{
“name”: “Commerce”,
“label”: “Commerce”,
“description”: null,
“type”: “string”,
“db_type”: “char(38)”,
“length”: 38,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: true,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_foreign_key”: true,
“is_unique”: false,
“is_index”: true,
“ref_table”: “postbase”,
“ref_fields”: “Oid”,
“picklist”: null,
“validation”: null,
“alias”: null
}
],
“related”: [
{
“name”: “imagedetail_by_PostBase”,
“type”: “has_many”,
“ref_table”: “imagedetail”,
“ref_fields”: “PostBase”,
“field”: “Oid”,
“join”: null
},
{
“name”: “postbase_by_Commerce”,
“type”: “belongs_to”,
“ref_table”: “postbase”,
“ref_fields”: “Oid”,
“field”: “Commerce”,
“join”: null
},
{
“name”: “xpobjecttype_by_ObjectType”,
“type”: “belongs_to”,
“ref_table”: “xpobjecttype”,
“ref_fields”: “OID”,
“field”: “ObjectType”,
“join”: null
},
{
“name”: “postbaseattribute_by_PostBase”,
“type”: “has_many”,
“ref_table”: “postbaseattribute”,
“ref_fields”: “PostBase”,
“field”: “Oid”,
“join”: null
},
{
“name”: “descriptionattribute_by_postbaseattribute”,
“type”: “many_many”,
“ref_table”: “descriptionattribute”,
“ref_fields”: “Oid”,
“field”: “Oid”,
“join”: “postbaseattribute(PostBase,DescriptionAttribute)”
},
{
“name”: “tagtags_postbasepostbases_by_PostBases”,
“type”: “has_many”,
“ref_table”: “tagtags_postbasepostbases”,
“ref_fields”: “PostBases”,
“field”: “Oid”,
“join”: null
},
{
“name”: “tag_by_tagtags_postbasepostbases”,
“type”: “many_many”,
“ref_table”: “tag”,
“ref_fields”: “Oid”,
“field”: “Oid”,
“join”: “tagtags_postbasepostbases(PostBases,Tags)”
}
],
“primary_key”: “Oid”,
“name_field”: null,
“access”: 31
}


#2

Hello @Jose_Manuel_Ojeda, please, when you paste some code, put it within the code style. It’s very exhausting trying to understand a non-indent and non-formatted code.

Which db are you using?


#3

If it’s mysql, maybe could be this or that.


#4

There is a bug that I found last week with accessing related data. It will not work unless the relationship names are all lowercase. This issue is resolved in the next release (currently scheduled for 11/20.)


#5

I just did a new test with postgres and the same happened so the problem is not related to mysql only is general problem of the database API


#6

http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html


#7

@Jose_Manuel_Ojeda, you are correct this bug is not limited to mysql. As I said it is resolved in the next release, which should be available tomorrow on Github.


#8

Hi @drewpearce I guess I will have to wait for the next release of the bitnami installer to see if this is fixed right?


#9

Bitnami installs can be updated from github, if you are comfortable with git and the command line.
In windows you’ll need to install a git shell (there are a few of these available.)

The basic update process is copy the htdocs folder. Run git pull, then composer install.

Details here: http://wiki.dreamfactory.com/DreamFactory/Installation#Upgrade

FYI, that update referenced above has not yet shipped. Targeting end of the day today.


#10

@drewpearce did you upload the new dreamfactory version? any idea when its going to be available as bitnami installer?


#11

New version didn’t get pushed until last night. It is now live on the master branch ( https://github.com/dreamfactorysoftware/dreamfactory )

We have notified Bitnami of the changes and they are working on a package release. I don’t have an ETA on that yet.


#12

Thanks @drewpearce ill give it a try