Open clemlatz opened 3 years ago
Just went to report the same issue, with the same workaround
<column name="[To Name]" tableMapName="ToName" phpName="ToName" type="VARCHAR" size="100"/>
However, there was still some parts of class's that where generated with the column name , not the tableMapName or phpName
We had to change the vendor/propel/propel/src/Propel/Generator/Model/Column.php
function getLowercasedName() like this
public function getLowercasedName(): string
{
return strtolower($this->getPhpName());
// return strtolower($this->name);
}
I have a column in a legacy database schema that has hyphens in its name (
cart_as-a-gift
). The column in my schema.xml (generated usingpropel:reverse
) looks like this:Running
model:build
works fine but when I'm trying to use the generated classes, I get an syntax error:The generated table map looks like this:
The problem here is that the php constant name stills contains dashes, which is invalid.
A quick workaround I've found for this is to define a
tableMapName
for the column:But, as hyphens are valid in mysql columns name, shouldn't propel convert them to underscore when generating the constant name ?
Note : this problem is happening as I'm trying to update from 2.0.0-alpha12 to 2.0.0-beta.1. It didn't happen before. Using 2.0.0-alpha12, the generated constant name is still invalid, but somehow it is never called.