Login | Register
My pages Projects Community openCollabNet

Discussions > dev > AS column behavior change

Discussion topic

Back to topic list

AS column behavior change


Author hlellelid
Full name Hans Lellelid
Date 2008-06-16 05:15:46 PDT
Message I should have pointed this out earlier. The AS columns behavior has
changed in the 1.3 RC1 to correct for what I feel was a bug in previous
versions. This does, however, require a slight change to your code if you
are using Criteria->addAsColumn() with queries that hydrate Propel objects.

This is also reflected now in the upgrade guide:

With ticket 634 (http://propel.phpdb.​org/trac/ticket/634)​, the behavior for
As columns (added via Criteria->addAsColumn()) has changed slightly. "As"
columns are now considered a valid select clause, and the generated Peer
classes will not automatically add the Peer columns if there are already As
clause elements present. While this allows you to use Criteria for queries
that do not populate objects, it also requires that you add the select
columns yourself if you do want to populate objects. Use the
GeneratedPeer::attSe​lectColumns(Criteria​) method to add the select columns.

For example:

$c = new Criteria(MyPeer::DAT​ABASE_NAME);
$c->addAsColumn('colname', 'expr');

Let me know if you have any questions about this.


« Previous message in topic | 1 of 1 | Next message in topic »


Show all messages in topic

AS column behavior change hlellelid Hans Lellelid 2008-06-16 05:15:46 PDT
Messages per page: