Skip to content

Commit

Permalink
[DoctrineBundle] fixed non-working safe-guards (closes #1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 5, 2011
1 parent 8457bfa commit 9d18b38
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Symfony/Bundle/DoctrineBundle/Mapping/MetadataFactory.php
Expand Up @@ -48,7 +48,8 @@ public function __construct(Registry $registry)
public function getBundleMetadata(BundleInterface $bundle)
{
$namespace = $bundle->getNamespace();
if (!$metadata = $this->getMetadataForNamespace($namespace)) {
$metadata = $this->getMetadataForNamespace($namespace);
if (!$metadata->getMetadata()) {
throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bundle->getName()));
}

Expand All @@ -70,7 +71,8 @@ public function getBundleMetadata(BundleInterface $bundle)
*/
public function getClassMetadata($class, $path = null)
{
if (!$metadata = $this->getMetadataForClass($class)) {
$metadata = $this->getMetadataForClass($class);
if (!$metadata->getMetadata()) {
throw new \RuntimeException(sprintf('Entity "%s" is not a mapped entity.', $class));
}

Expand Down Expand Up @@ -98,7 +100,8 @@ public function getClassMetadata($class, $path = null)
*/
public function getNamespaceMetadata($namespace, $path = null)
{
if (!$metadata = $this->getMetadataForNamespace($namespace)) {
$metadata = $this->getMetadataForNamespace($namespace);
if (!$metadata->getMetadata()) {
throw new \RuntimeException(sprintf('Namespace "%s" does not contain any mapped entities.', $namespace));
}

Expand Down

0 comments on commit 9d18b38

Please sign in to comment.