Search code examples
sql-server-2005propel

Propel, Having fields with spaces


Is it possible to have a space in the field name that is defined in the schema.xml?

The bright spark who design the database, used field names like 'POST CODE' and 'CURRENT'

Is there a way around this? or am i stuck?

The database is an existing MSSQL 2005 database, with an unknown number of systems connected to it. So it cannot be changed.

I am using the reverse command to generate the schema.xml

propel-gen . reverse

Propel 1.6.7


Solution

  • The only work around i have found is to remove the space in schema.xml, and then manually change each of the Base*Peer files.

    e.g. Change

    const POSTCODE = 'Customer.POSTCODE';
    const POSTCODE = 'Customer.CURRENT';
    

    to

    const POSTCODE = 'Customer.[POST CODE]';
    const POSTCODE = 'Customer.[CURRENT]';
    

    Update:

    I relised that i just need to add the 2 lines to the CustomerPeer.php not BaseCustomerPeer.php, that way i dont need to remeber it next time propel is built.