Fix CS and test configuration
This commit is contained in:
parent
ab9ff813fc
commit
49f9d185de
3 changed files with 24 additions and 5 deletions
|
@ -639,7 +639,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||||
*/
|
*/
|
||||||
public function setQuoteStrategy(QuoteStrategy $quoteStrategy)
|
public function setQuoteStrategy(QuoteStrategy $quoteStrategy)
|
||||||
{
|
{
|
||||||
$this->_attributes['quoteStrategy'] = $namingStrategy;
|
$this->_attributes['quoteStrategy'] = $quoteStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,8 +47,8 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||||
public function getTableName(ClassMetadata $class, AbstractPlatform $platform)
|
public function getTableName(ClassMetadata $class, AbstractPlatform $platform)
|
||||||
{
|
{
|
||||||
return isset($class->table['quoted'])
|
return isset($class->table['quoted'])
|
||||||
? $platform->quoteIdentifier($class->table['name'])
|
? $platform->quoteIdentifier($class->table['name'])
|
||||||
: $class->table['name'];
|
: $class->table['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,8 +57,8 @@ class DefaultQuoteStrategy implements QuoteStrategy
|
||||||
public function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform)
|
public function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform)
|
||||||
{
|
{
|
||||||
return isset($definition['quoted'])
|
return isset($definition['quoted'])
|
||||||
? $platform->quoteIdentifier($definition['sequenceName'])
|
? $platform->quoteIdentifier($definition['sequenceName'])
|
||||||
: $definition['sequenceName'];
|
: $definition['sequenceName'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,6 +44,20 @@ class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase
|
||||||
return $cm;
|
return $cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testConfiguration()
|
||||||
|
{
|
||||||
|
$em = $this->_getTestEntityManager();
|
||||||
|
$config = $em->getConfiguration();
|
||||||
|
|
||||||
|
$this->assertInstanceOf('Doctrine\ORM\Mapping\QuoteStrategy', $config->getQuoteStrategy());
|
||||||
|
$this->assertInstanceOf('Doctrine\ORM\Mapping\DefaultQuoteStrategy', $config->getQuoteStrategy());
|
||||||
|
|
||||||
|
$config->setQuoteStrategy(new MyQuoteStrategy());
|
||||||
|
|
||||||
|
$this->assertInstanceOf('Doctrine\ORM\Mapping\QuoteStrategy', $config->getQuoteStrategy());
|
||||||
|
$this->assertInstanceOf('Doctrine\Tests\ORM\Mapping\MyQuoteStrategy', $config->getQuoteStrategy());
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetColumnName()
|
public function testGetColumnName()
|
||||||
{
|
{
|
||||||
$cm = $this->createClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
$cm = $this->createClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||||
|
@ -175,4 +189,9 @@ class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase
|
||||||
$joinColumn = $cm->associationMappings['article']['joinColumns'][0];
|
$joinColumn = $cm->associationMappings['article']['joinColumns'][0];
|
||||||
$this->assertEquals('"id"',$this->strategy->getReferencedJoinColumnName($joinColumn, $cm, $this->platform));
|
$this->assertEquals('"id"',$this->strategy->getReferencedJoinColumnName($joinColumn, $cm, $this->platform));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyQuoteStrategy extends \Doctrine\ORM\Mapping\DefaultQuoteStrategy
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue