Skip to content

Commit

Permalink
Extract NotSupported exception
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Nov 17, 2017
1 parent a0dbce8 commit 678811a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions lib/Doctrine/ORM/Tools/NotSupported.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Tools;

final class NotSupported extends SchemaToolException
{
public static function create() : self
{
return new self('This behaviour is (currently) not supported by Doctrine 2');
}
}
5 changes: 3 additions & 2 deletions lib/Doctrine/ORM/Tools/SchemaTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Doctrine\ORM\ORMException;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
use Doctrine\ORM\Tools\Event\GenerateSchemaTableEventArgs;
use Doctrine\ORM\Tools\NotSupported;

/**
* The SchemaTool is a tool to create/drop/update database schemas based on
Expand Down Expand Up @@ -238,7 +239,7 @@ public function getSchemaFromMetadata(array $classes)
break;

case InheritanceType::TABLE_PER_CLASS:
throw ORMException::notSupported();
throw NotSupported::create();

default:
$this->gatherColumns($class, $table);
Expand Down Expand Up @@ -561,7 +562,7 @@ private function gatherRelationsSql($class, $table, $schema, &$addedFks, &$black

case ($property instanceof OneToManyAssociationMetadata):
//... create join table, one-many through join table supported later
throw ORMException::notSupported();
throw NotSupported::create();

case ($property instanceof ManyToManyAssociationMetadata):
// create join table
Expand Down
9 changes: 9 additions & 0 deletions lib/Doctrine/ORM/Tools/SchemaToolException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Tools;

interface SchemaToolException
{
}

0 comments on commit 678811a

Please sign in to comment.