protected function addDoBuild(&$script) { parent::addDoBuild($script); // fix http://propel.phpdb.org/trac/ticket/235: Column sizes not being inserted into [table]MapBuilder->DoBuild() by PHP5MapBuilderBuilder $sizes = array(); foreach ($this->getTable()->getColumns() as $col) { $sizes[$col->getPhpName()] = !$col->getSize() ? 'null' : $col->getSize(); } $script = preg_replace("/\\\$tMap\\->addColumn\\('([^']+)', '([^']+)', '([^']+)', CreoleTypes\\:\\:VARCHAR, (false|true)\\)/e", '"\\\\$tMap->addColumn(\'$1\', \'$2\', \'$3\', CreoleTypes::VARCHAR, $4, {$sizes[\'$2\']})"', $script); }
protected function addDoBuild(&$script) { parent::addDoBuild($script); // fix http://propel.phpdb.org/trac/ticket/235: Column sizes not being inserted into [table]MapBuilder->DoBuild() by PHP5MapBuilderBuilder $sizes = array(); foreach ($this->getTable()->getColumns() as $col) { $sizes[$col->getPhpName()] = !$col->getSize() ? 'null' : $col->getSize(); } if (version_compare(PHP_VERSION, '5.5.0') >= 0) { $fn = function ($matches) use($tMap, $sizes) { return $tMap->addColumn($matches[1], $matches[2], $matches[3], CreoleTypes::VARCHAR, $matches[4], $sizes[$matches[2]]); }; $script = preg_replace_callback("/\\\$tMap\\->addColumn\\('([^']+)', '([^']+)', '([^']+)', CreoleTypes\\:\\:VARCHAR, (false|true)\\)/", $fn, $script); } else { $script = preg_replace("/\\\$tMap\\->addColumn\\('([^']+)', '([^']+)', '([^']+)', CreoleTypes\\:\\:VARCHAR, (false|true)\\)/e", '"\\\\$tMap->addColumn(\'$1\', \'$2\', \'$3\', CreoleTypes::VARCHAR, $4, {$sizes[\'$2\']})"', $script); } }