vaneves / collection-extractor
Doctrine Collection Extractor
v0.0.1
2015-09-23 16:59 UTC
Requires
- doctrine/doctrine-module: ^0.9.0
This package is not auto-updated.
Last update: 2025-01-08 12:22:44 UTC
README
Installing
Via Composer
composer require vaneves/collection-extractor
Usage
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();