Member-only story

Povilas Brilius
3 min readFeb 15, 2021

--

Essentially, I have managed to perform Red Beans installation on the plain dry model objects like planned —

return ['id' => $user->id,'email' => $user->email,'notes' => $user->countOwn('note'),'links' => [['rel' => 'self','uri' => '/users/' . $user->id,],],];

And, eureka — based it on internal list properties like $ownNoteList — bear in mind, that not $ownNotesList — i.e. the singular, not plural grammar expression is used internally by Red Beans themselves.

GET /index.php/api/v1/users HTTP/1.1Host: localhost:2526{
"data": [
{
"id": "48",
"email": "21b67482b44dcbd6a95d0fd2fa5d5de0",
"notes": {
"42": {
"id": "42",
"user": null,
"data": "{\"text\": \"Lorem ipsum...\"}",
"user_id": "48"
}
},
"links": [
{
"rel": "self",
"uri": "/users/48"
}
]
},
{
"id": "42",
"email": "2236eaebf9ad1d3d60266186d71280c1"…

--

--

Povilas Brilius
Povilas Brilius

Written by Povilas Brilius

PHP Developer in e-commerce and e-loans industry fields.

No responses yet