Skip to content

Commit

Permalink
Remove calls to prefersSequences()
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander M. Turek <me@derrabus.de>
  • Loading branch information
derrabus committed Aug 7, 2021
1 parent c4456a2 commit 4d06b88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,10 @@ private function completeIdGeneratorMapping(ClassMetadataInfo $class): void
{
$idGenType = $class->generatorType;
if ($idGenType === ClassMetadata::GENERATOR_TYPE_AUTO) {
if ($this->getTargetPlatform()->prefersSequences()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
} elseif ($this->getTargetPlatform()->prefersIdentityColumns()) {
if ($this->getTargetPlatform()->supportsIdentityColumns()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
} elseif ($this->getTargetPlatform()->supportsSequences()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
} else {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_TABLE);
}
Expand Down
20 changes: 12 additions & 8 deletions tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ class DatabasePlatformMock extends AbstractPlatform
/** @var bool */
private $_prefersSequences = false;

/**
* {@inheritdoc}
*/
public function prefersIdentityColumns()
public function prefersIdentityColumns(): bool
{
return $this->_prefersIdentityColumns;
}

/**
* {@inheritdoc}
*/
public function prefersSequences()
public function supportsIdentityColumns(): bool
{
return $this->_prefersIdentityColumns;
}

public function prefersSequences(): bool
{
return $this->_prefersSequences;
}

public function supportsSequences(): bool
{
return $this->_prefersSequences;
}
Expand Down

0 comments on commit 4d06b88

Please sign in to comment.