doctrine2 - How do I configure apigility to use Doctrine's MongoDB ODM? -


i’m trying use apigility doctrine’s mongodb odm.
i’ve set documents , configured doctrine module should.
i’ve inserted (manually) 1 document mongo, , defined code-based rest service, “fetch” method (in resource class) return document's repository "find" return value.

when call endpoint (without id) array of single document i’ve inserted, it’s not shown correctly:

{   "_links": {     "self": {       "href": "http://localhost:8888/posts"     }   },   "_embedded": {     "posts": [       {         "\u0000myapp\\document\\post\u0000id": "5389db47075000812e55bd7d",         "\u0000myapp\\document\\post\u0000title": "my post",         "\u0000myapp\\document\\post\u0000description": "this post",         "_links": {           "self": {             "href": "http://localhost:8888/posts/1"           }         }       }     ]   },   "total_items": 1 } 

there (at least) 2 problems output:

  1. the key of each property weirdly formatted. contains complete namespace document name, , utf8 code null
  2. the “self” link not use correct id (it uses number 1 instead of mongodb autogenerated id).

what wrong/missing ?

this happens when php uses objectproperty (\zend\stdlib\hydrator\objectproperty )hydrator populating objects.and in apigility if dont specify hydrator fall objectproperty hydrator(default), seems case ouput. use classmethods hydrator (\zend\stdlib\hydrator\classmethods) instead.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -