Skip to content

Commit

Permalink
Fix the repeat calling of getReservedKeywordsClass() that causes a co…
Browse files Browse the repository at this point in the history
…nsiderable slow down when running lots of migrations.
  • Loading branch information
dt-creasis committed Jun 7, 2012
1 parent e537745 commit 081f324
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Expand Up @@ -106,6 +106,13 @@ abstract class AbstractPlatform
*/
protected $_eventManager;

/**
* Holds the KeywordList instance for the current platform.
*
* @var Doctrine\DBAL\Platforms\Keywords\KeywordList
*/
protected $_keywords;

/**
* Constructor.
*/
Expand Down Expand Up @@ -2682,11 +2689,20 @@ public function rollbackSavePoint($savepoint)
*/
final public function getReservedKeywordsList()
{
// Check for an existing instantiation of the keywords class.
if($this->keywords) {
return $this->keywords;
}

$class = $this->getReservedKeywordsClass();
$keywords = new $class;
if ( ! $keywords instanceof \Doctrine\DBAL\Platforms\Keywords\KeywordList) {
throw DBALException::notSupported(__METHOD__);
}

// Store the instance so it doesn't need to be generated on every request.
$this->keywords = $keywords;

return $keywords;
}

Expand Down

0 comments on commit 081f324

Please sign in to comment.