The relevant portion of my schema.xml
:
<database name="Inventory" defaultIdMethod="native"> <table name="Users" phpName="User"> <column name="UserId" type="varchar" size="20" required="true" primaryKey="true" /> <column name="FirstName" type="varchar" size="255" required="true" /> <column name="LastName" type="varchar" size="255" required="true" /> <column name="Password" type="varchar" size="255" required="true" /> <column name="Salt" type="char" size="22" required="true" /> <column name="RoleId" type="integer" required="true" /> <column name="FailedLogins" type="integer" required="true" defaultValue="0" /> <column name="LockedOut" type="boolean" required="true" defaultValue="false" /> <column name="Active" type="boolean" required="true" defaultValue="true" /> </table> ... </database>
The following command fails with a PropelException
:
UserQuery::create() ->filterByActive(true) ->update(array('FailedLogins' => 0, 'LockedOut' => false));
The error:
[Sat Nov 19 16:28:01 2011] [error] [client 127.0.0.11] PHP Fatal error: Uncaught exception 'PropelException' with message 'Cannot fetch ColumnMap for undefined column phpName: FailedLogins' in /home/andrew/pss-repository/vendor/propel/runtime/lib/map/TableMap.php:372\nStack trace:\n#0 /home/andrew/pss-repository/vendor/propel/runtime/lib/query/ModelCriteria.php(1668): TableMap->getColumnByPhpName('FailedLogins')\n#1 /home/andrew/pss-repository/vendor/propel/runtime/lib/query/ModelCriteria.php(1626): ModelCriteria->doUpdate(Array, Object(PropelPDO), false)\n#2 /home/andrew/pss-repository/login-reset-process.php(11): ModelCriteria->update(Array)\n#3 {main}\n thrown in /home/andrew/pss-repository/vendor/propel/runtime/lib/map/TableMap.php on line 372, referer: http://pss/login-reset-all.php
I am able to verify that the FailedLogins
column is identified as Failedlogins
in the Propel-generated code. I realize that I can probably add phpName
to the columns in question, but I was wondering if I have missed a configuration option. I checked the Propel buildtime configuration page, and I see an option called propel.samePhpName
, but as it is under the "Reverse Engineering" section it does not appear to be the option I need. Others have asked similar questions, but I have not seen a clear answer.
Is there a configuration option to make the phpName
of each column simply match the name
attribute in the schema?