https://github.com/ttskch/doctrine-sub-query-sample
Example of doctrine sub query to select maximums per groups
https://github.com/ttskch/doctrine-sub-query-sample
Last synced: 11 months ago
JSON representation
Example of doctrine sub query to select maximums per groups
- Host: GitHub
- URL: https://github.com/ttskch/doctrine-sub-query-sample
- Owner: ttskch
- License: mit
- Created: 2020-04-25T01:50:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T08:16:09.000Z (over 5 years ago)
- Last Synced: 2025-02-08T12:25:28.196Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# doctrine-sub-query-sample
## Installation
```bash
$ git clone git@github.com:ttskch/doctrine-sub-query-sample.git
$ cd doctrine-sub-query-sample
$ composer install
$ bin/console doctrine:migrations:migrate -n
```
## Usage
```bash
$ symfony serve -d
```
```
$ curl localhost:8000 | jq .
[
{
"id": 2,
"post_id": 1,
"content": "newer comment for post1",
"created_at": {
"date": "2020-01-02 00:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"published": true
},
{
"id": 3,
"post_id": 2,
"content": "older comment for post2",
"created_at": {
"date": "2020-01-03 00:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"published": true
}
]
```
```
$ curl localhost:8000/1 | jq .
[
{
"id": 2,
"post_id": 1,
"content": "newer comment for post1",
"created_at": {
"date": "2020-01-02 00:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"published": true
}
]
```
```
$ curl localhost:8000/2 | jq .
[
{
"id": 3,
"post_id": 2,
"content": "older comment for post2",
"created_at": {
"date": "2020-01-03 00:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"published": true
}
]
```
```
$ curl localhost:8000/3 | jq .
[]
```