• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Model / Entities relation

#6
ok, i start to understand how it work.

In a perfect world, i request my database via the model and he give me an object UserEntity. And in a perfect world, i just have to send it as it with all my data formated like i want defined in my entity.

like this :
Code:
{
  "id": 1,
  "firstname": "Darth",
  "lastname": "Vader",
  "created_at": {
    "date": "2019-02-08 12:27:42.000000",
    "timezone": "Europe/Paris",
    "locale": "en"
  },
  "deleted": false
}

but in fact...

i got an object UserEntity with all accessors protected. and a json_encode(Entity) is not a valid json. Because he try ton convert a custom object and not a generic.

What do i need to get my entity and send it formated like he have to be ?

maybe the $this->response->setJSON() have a problem somewhere...
Reply


Messages In This Thread
Model / Entities relation - by keulu - 02-20-2019, 02:45 AM
RE: Model / Entities relation - by puschie - 02-22-2019, 03:10 AM
RE: Model / Entities relation - by keulu - 02-22-2019, 07:09 AM
RE: Model / Entities relation - by puschie - 02-25-2019, 07:17 AM
RE: Model / Entities relation - by keulu - 02-26-2019, 11:31 AM
RE: Model / Entities relation - by keulu - 02-26-2019, 01:41 PM
RE: Model / Entities relation - by keulu - 02-27-2019, 11:52 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.