inject quote strategy into sql walker
This commit is contained in:
parent
2b4c29e4f2
commit
1bcda5147a
@ -634,11 +634,11 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||
* Set quote strategy class.
|
||||
*
|
||||
* @since 2.4
|
||||
* @param string $namingStrategy
|
||||
* @param string $className
|
||||
*/
|
||||
public function setQuoteStrategyClassName($className)
|
||||
{
|
||||
$quoteStrategy = 'Doctrine\Mapping\AbstractQuoteStrategy';
|
||||
$quoteStrategy = 'Doctrine\ORM\Mapping\AbstractQuoteStrategy';
|
||||
|
||||
if ($className !== $quoteStrategy && ! is_subclass_of($className, $quoteStrategy)) {
|
||||
throw new \InvalidArgumentException("Invalid quote strategy class");
|
||||
@ -657,6 +657,6 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||
{
|
||||
return isset($this->_attributes['quoteStrategyClassName'])
|
||||
? $this->_attributes['quoteStrategyClassName']
|
||||
: 'Doctrine\Mapping\DefaultQuoteStrategy';
|
||||
: 'Doctrine\ORM\Mapping\DefaultQuoteStrategy';
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,13 @@ class EntityManager implements ObjectManager
|
||||
*/
|
||||
private $metadataFactory;
|
||||
|
||||
/**
|
||||
* The quote strategy.
|
||||
*
|
||||
* @var \Doctrine\ORM\Mapping\QuoteStrategy.
|
||||
*/
|
||||
private $quoteStrategy;
|
||||
|
||||
/**
|
||||
* The EntityRepository instances.
|
||||
*
|
||||
@ -132,9 +139,11 @@ class EntityManager implements ObjectManager
|
||||
$this->config = $config;
|
||||
$this->eventManager = $eventManager;
|
||||
|
||||
$metadataFactoryClassName = $config->getClassMetadataFactoryName();
|
||||
|
||||
$this->metadataFactory = new $metadataFactoryClassName;
|
||||
$quoteStrategyClassName = $config->getQuoteStrategyClassName();
|
||||
$metadataFactoryClassName = $config->getClassMetadataFactoryName();
|
||||
|
||||
$this->quoteStrategy = new $quoteStrategyClassName($conn->getDatabasePlatform());
|
||||
$this->metadataFactory = new $metadataFactoryClassName;
|
||||
$this->metadataFactory->setEntityManager($this);
|
||||
$this->metadataFactory->setCacheDriver($this->config->getMetadataCacheImpl());
|
||||
|
||||
@ -167,6 +176,16 @@ class EntityManager implements ObjectManager
|
||||
return $this->metadataFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the quote strategy.
|
||||
*
|
||||
* @return \Doctrine\ORM\Mapping\QuoteStrategy
|
||||
*/
|
||||
public function getQuoteStrategy()
|
||||
{
|
||||
return $this->quoteStrategy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an ExpressionBuilder used for object-oriented construction of query expressions.
|
||||
*
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user