Skip to content

Instantly share code, notes, and snippets.

@astorm
Created May 31, 2015 22:34
Show Gist options
  • Save astorm/f245ce9c761c9a8053aa to your computer and use it in GitHub Desktop.
Save astorm/f245ce9c761c9a8053aa to your computer and use it in GitHub Desktop.
<?php
//never do this for read, use __construct dependency injection
$r = new ReflectionObject($app);
$prop = $r->getProperty('_objectManager');
$prop->setAccessible(true);
$manager = $prop->getValue($app);
//generates a factory, assuming `Pulsestorm\Helloworld\Test` exists
$factory = $manager->get('Pulsestorm\Helloworld\TestFactory');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment