From 90dfca91d042eafa1930aab7887c00fb7063959c Mon Sep 17 00:00:00 2001 From: Robert Gruendler Date: Tue, 16 Feb 2010 12:50:40 +0100 Subject: [PATCH] migrations fix --- .../lib/vendor/doctrine/Doctrine/Connection.php | 11 ++++++++--- .../lib/vendor/doctrine/Doctrine/Core.php | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php b/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php index cb2556d..78606a3 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php +++ b/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php @@ -1599,7 +1599,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun $key = implode('_', array_merge($parts, array($relation['onDelete']), array($relation['onUpdate']))); $format = $this->getAttribute(Doctrine_Core::ATTR_FKNAME_FORMAT); - return $this->_generateUniqueName('foreign_keys', $parts, $key, $format, $this->properties['max_identifier_length']); + return $this->_generateUniqueName('foreign_keys', $parts, $key, $format, $this->getAttribute(Doctrine_Core::ATTR_MAX_IDENTIFIER_LENGTH)); } /** @@ -1617,11 +1617,16 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun $key = implode('_', $parts); $format = $this->getAttribute(Doctrine_Core::ATTR_IDXNAME_FORMAT); - return $this->_generateUniqueName('indexes', $parts, $key, $format, $this->properties['max_identifier_length']); + return $this->_generateUniqueName('indexes', $parts, $key, $format, $this->getAttribute(Doctrine_Core::ATTR_MAX_IDENTIFIER_LENGTH)); } - protected function _generateUniqueName($type, $parts, $key, $format = '%s', $maxLength = 64) + protected function _generateUniqueName($type, $parts, $key, $format = '%s', $maxLength = null) { + + if (null === $maxLength) { + $maxLength = $this->properties['max_identifier_length']; + } + if (isset($this->_usedNames[$type][$key])) { return $this->_usedNames[$type][$key]; } diff --git a/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php b/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php index 61bbf56..5001f2b 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php +++ b/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php @@ -208,6 +208,7 @@ class Doctrine_Core const ATTR_TABLE_CLASS = 176; const ATTR_USE_NATIVE_SET = 177; const ATTR_MODEL_CLASS_PREFIX = 178; + const ATTR_MAX_IDENTIFIER_LENGTH = 179; /** * LIMIT CONSTANTS -- 1.6.4.4