muszę skorzystać z pola typu BLOB lub LONGTEXT, niby wszystko spoko, w polach tych znajduje się json:
Kod
{ "data": {
"applications":
[
{
"id":0,
"name": "Redmine",
"url": "http://link",
"require_login": true,
"icon_url": "assets/userfiles/icon123.png"
},
{
"id":1,
"name": "Admin",
"url": "http://link",
"require_login": false,
"icon_url": "assets/userfiles/icon123.png"
}
]
}}
"applications":
[
{
"id":0,
"name": "Redmine",
"url": "http://link",
"require_login": true,
"icon_url": "assets/userfiles/icon123.png"
},
{
"id":1,
"name": "Admin",
"url": "http://link",
"require_login": false,
"icon_url": "assets/userfiles/icon123.png"
}
]
}}
Podczas próby pobrania tych wartości poprzez chociażby:
$doctrineManager = $this->getDoctrine()->getManager(); $query = $doctrineManager->createQuery( "SELECT u.settings FROM ApiRestServiceBundle:UserSettings u WHERE u.id=5" ); $result = $query->getResult();
otrzymuję:
Kod
resource(480, stream)
...Gdy próbuję zwrócić json do aplikacji poprzez:
$response = new Response(json_encode($data)); $response->headers->set('Content-Type', 'application/json'); return $response;
otrzymuję:
Kod
Warning: json_encode(): type is unsupported, encoded as null in F:\WORK\grzegorztomasiak\service_rest_api\src\ApiRest\ServiceBundle\Controller\UserSettingController.php line 79
Jak się do tego dostać żeby zobaczyć to co wrzuciłem w json do mysql ?
EDIT::
Lub jeśli dobrze znalazłem, to symfony nie obsługuje innych typów niż: http://docs.doctrine-project.org/projects/...ence/types.html ?