propelorm/Propel — Issue #137: Namespace causes getCriterionForClause to fail
Author: nikcorg
Created: 2011-10-11 12:47:25+00:00
State: open

I stumbled upon a scenario where `ModelCriteria::getCriterionForClause` would fail with the exception `Cannot determine the column to bind to the parameter in clause 'CampaignName.Enabled = ?'`, even though the column in question is indeed defined in `schema.xml` and in the TableMap class.

A workaround for the issue was found when asking for help on Propel's excellent irc-channel, but the suspicion that the behaviour is indeed a bug and specifically related to namespaces arose while analyzing the problem.

Without further ado, here are the details.

The relevant parts of the schema:

The failing query:

CampaignNameQuery::create()
->where('CampaignName.Enabled = ?', 1)
->find();

// Fails with: `Cannot determine the column to bind to the parameter in clause 'CampaignName.Enabled = ?'`

The workaround:

CampaignNameQuery::create('cn')
->where('cn.Enabled = ?')
->find();