Skip to content

Instantly share code, notes, and snippets.

@leopro
Last active October 13, 2015 01:28
Show Gist options
  • Save leopro/4118053 to your computer and use it in GitHub Desktop.
Save leopro/4118053 to your computer and use it in GitHub Desktop.
<?php
public function getRepository($name)
{
$em = $this->getEntityManager();
$entity = $this->getExtendedEntity($name);
if (is_null($entity)) {
$entity = $this->getDefaultEntity($name);
}
if (is_null($entity)) {
throw new \RuntimeException(sprintf("The class %s was not found", $entity));
}
return $this->doctrine->getRepository($entity, $em);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment