-
-
Save jmontoyaa/4353774 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$app['form.extensions'] = $app->share($app->extend('form.extensions', function ($extensions, $app) { | |
$managerRegistry = new ManagerRegistry(null, array(), array('doctrine_orm.em'), null, null, '\Doctrine\ORM\Proxy\Proxy'); | |
$managerRegistry->setContainer($app); | |
$extensions[] = new DoctrineOrmExtension($managerRegistry); | |
return $extensions; | |
})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Umpirsky\Doctrine\Common\Persistance; | |
use Doctrine\Common\Persistence\AbstractManagerRegistry; | |
use Silex\Application; | |
/** | |
* References Doctrine connections and entity/document managers. | |
* | |
* @author Саша Стаменковић <[email protected]> | |
*/ | |
class ManagerRegistry extends AbstractManagerRegistry | |
{ | |
/** | |
* @var Application | |
*/ | |
protected $container; | |
protected function getService($name) | |
{ | |
return $this->container[$name]; | |
} | |
protected function resetService($name) | |
{ | |
unset($this->container[$name]); | |
} | |
public function getAliasNamespace($alias) | |
{ | |
throw new \BadMethodCallException('Namespace aliases not supported.'); | |
} | |
public function setContainer(Application $container) | |
{ | |
$this->container = $container; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment