mevdschee / mevdschee/php-crud-api
One To Many Relation output an array
Open
@mevdschee is already working on this.
Since Jul 13, 2016.
enhancement
- Dominant language
- PHP
- Stars
- 3.7k
- Forks
- 1k
- Avg merge
- 1h 55m
- Merged PRs (30d)
- 7
Description
Hi
I have the folowing database :

and I am trying to get the sections with their corresponding department and directorate, the output is the following
{
"sections": [
{
"ID": "1",
"NAME": "section1",
"DEPARTMENT_ID": "1",
"departments": [
{
"ID": "1",
"NAME": "depart 1",
"DIRECTORATE_ID": "1",
"directorates": [
{
"ID": "1",
"NAME": "directorate1",
"PHONE_NUMBER": "123",
"ROOM_NUMBER": "123"
}
],
"EDL_ID": "65",
"PHONE_NUMBER": "659",
"ROOM_NUMBER": "987"
}
],
"PHONE_NUMBER": "654",
"ROOM_NUMBER": "865"
}
]
}
I think it will be better if the departments returned for the section is not an array, it can be directly the department object? a section has a department. and the same for the directorate in the department.
What do you think about this?
Thank you
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.