You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It throws an exception like: throw new PropelException("Cannot find selected column '$columnName'"); in ModelCriteria.php at line 2389
What is the reason?, in order to create the count statement, in the Query classes there are some instructions that have to clear the selectColumns and asColumns arrays in order to add only the count(*) to the statement:
// Replace SELECT columns with COUNT(*)
$this->clearSelectColumns()->addSelectColumn('COUNT(*)');
$sql = $this->createSelectSql($params);
Everybody could find these three lines (including the comment) in the doCount method into every Query classes.
The problem is that the clearSelectColumns method from the Criteria class do this:
public function clearSelectColumns()
{
$this->selectColumns = $this->asColumns = [];
return $this;
}
instead of this:
public function clearSelectColumns()
{
$this->selectColumns = $this->asColumns = $this->select = [];
return $this;
}
And it causes the exception because the withColumn still being into the select when try to verify all the fields before doing the count.
I tried with several examples this change and it only affects to the count statements, so it could be a good fix for that.
Thanks
The text was updated successfully, but these errors were encountered:
Taking this example:
It throws an exception like:
throw new PropelException("Cannot find selected column '$columnName'"); in ModelCriteria.php at line 2389
What is the reason?, in order to create the count statement, in the Query classes there are some instructions that have to clear the selectColumns and asColumns arrays in order to add only the count(*) to the statement:
Everybody could find these three lines (including the comment) in the doCount method into every Query classes.
The problem is that the clearSelectColumns method from the Criteria class do this:
instead of this:
And it causes the exception because the withColumn still being into the select when try to verify all the fields before doing the count.
I tried with several examples this change and it only affects to the count statements, so it could be a good fix for that.
Thanks
The text was updated successfully, but these errors were encountered: