https://github.com/vaneves/collection-extractor
Doctrine Collection Extractor
https://github.com/vaneves/collection-extractor
Last synced: about 1 month ago
JSON representation
Doctrine Collection Extractor
- Host: GitHub
- URL: https://github.com/vaneves/collection-extractor
- Owner: vaneves
- License: unlicense
- Created: 2015-09-23T16:32:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-23T17:02:42.000Z (over 10 years ago)
- Last Synced: 2025-01-10T09:21:31.676Z (over 1 year ago)
- Language: PHP
- Size: 137 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Doctrine Collection Extractor
## Installing
Via Composer
```
composer require vaneves/collection-extractor
```
## Usage
``` php
use Silex\Application;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;
use Vaneves\Doctrine\CollectionExtractor;
$app = new Application();
$app['debug'] = true;
$app->get('/blog/posts', function () use ($app) {
$em = $app['orm.em'];
$results = $em->getRepository('App\Entities\Post')->findAll();
$hydrator = new CollectionExtractor(new DoctrineHydrator($em));
return $app->json($hydrator->extract($results));
});
$app->run();
```