Just a quick one, as others may have this problem (or point me to a better answer):

I’ve been using symfony to add a few standalone bits to a project that already uses propel. This means I already have a schema.xml file, so rather than create a separate schema.yml for symfony, I symlinked the existing schema.yml file into symfony’s config directory.

The schema.xml file has phpname attributes for most fields, as the database also works with some pre-propel code – so it was easiest to use phpname to make the field names easy to work with without changing the schema/existing code.

This appeared to work fine, symfony happily built models and admin generator pages and all worked as expected.

Then I tried to turn on some of the filters, and they all appeared disabled. I spent a while looking at why, and eventually tracked it down to this:

In “lib/plugins/sfPropelPlugin/lib/propel/generator/sfPropelAdminGenerator.class.php”

public function getColumnForPhpName($phpName)
{
// search the matching column for this column name
foreach ($this->getTableMap()->getColumns() as $column)
{
if ($column->getPhpName() == $phpName)
{
$found = true;
return $column;
}
}
// not a “real” column, so we will simulate one
return null;
}

And found that if I modified it to this it worked:

public function getColumnForPhpName($phpName)
{
// search the matching column for this column name

foreach ($this->getTableMap()->getColumns() as $column)
{
if (strtolower($column->getPhpName()) == strtolower($phpName))
{
$found = true;
return $column;
}
}
// not a “real” column, so we will simulate one
return null;
}
}

(I’ve added strtolower to the comparison).

I believe this is because symfony expects the propel names for things to be as it would generate them from the schema.yml file. But in this case, propel uses the phpName attributes from schema.xml, so that assumption is wrong (or something along these lines – I’m fairly sure its because I’ve used phpname rather than letting symfony/propel do their magic). This fixes it – it probably creates other issues … but nothing I’ve noticed in the bits I’ve used.

Versions of Symfony:

Symfony 1.1 (sandbox or pear installed)
Tried with propel 1.2 and 1.3 plugin – same issue. Fix tried on propel 1.2.