What the #@#$F!?
If you just can't get it working, the answer might be here. If it's not here, you may wish to report a bug? so we can address it.
Build Errors
I'm getting a weird MySQL error 150 when I run the 'insert-sql' target
This is a pretty generic error used by InnoDB to indicate that some constraint is wrong. Read the error message (SHOW INNODB STATUS) to see if it gives you any more information.
Propel generated two setXXXX() methods in my object!
This might have happened because you are using foreign keys and you have a related table with the same name as a column in the local table. For example this will not work:
<column name="reader" type="INTEGER"/> <foreign-key foreignTable="reader"> <reference local="reader" foreign="id"/> </foreign-key>The above code will create two setReader() methods: one for setting a related Reader object and one for setting the value of the reader column. Solution? Either use column names like 'reader_id' for the foreign keys, or specify a unique name to use for the PHP method, using the phpName attribute:
<column name="reader" phpName="ReaderId" type="INTEGER"/>
Something about undefined class "Iterator" or "IteratorAggregate"
Propel requires a the SPL language extensions to be compiled into PHP. SPL includes the Iterator and IteratorAggregate interfaces which allow you to use the foreach() construct with an object.
"Class PhingFile does not exist"
This error indicates that you need to upgrade your version of Phing. The current SVN version of Propel requires Phing 2.1.0.
For those using Phing from PEAR, upgrade like this:
$> pear upgrade http://phing.info/pear/phing-current.tgzOther users can visit the Phing project page to download the latest packages.
"Class 'File' not found in ..."
This error indicates that you upgraded your version of Phing without upgrading Propel. Phing 2.1.0 requires the current SVN version of Propel.
Fatal Error: Undefined class constant 'CHAR' in PropelTypes.php
This is probably caused by mixing PHP4 versions of Creole with PHP5 version of Propel. It is not advised to have both PHP4 and PHP5 versions of Propel or Creole installed -- and if you do, you need to be extra careful with your include_path values to ensure that they don't get mixed up.
Runtime Errors
TIMESTAMP column colum is being changed even if I didn't set it!
It sounds like you are using MySQL. In Propel 1.0 alpha1 and alpha2 releases the "TIMESTAMP" Propel type is being translated to the MySQL native "TIMESTAMP" type when it should be translated to the "DATETIME" type. In MySQL prior to 4.1 TIMESTAMP columns are very idiosycratic: unreadable YYYYMMDDHHMMSS format and are automatically updated to current time when a new column is inserted or when they are set to NULL. For that reason the latest versions of Propel are correctly using the DATETIME column, which is akin to the TIMESTAMP column types in other RDBMS.
If you have an affected version, the simplest solution is just to change your column type to DATETIME from within MySQL.
mysql> ALTER TABLE mytable MODIFY timestampcol DATETIME;You can also updgrade to a post-alpha2 release (if available) or use CVS.
I'm seeing \" characters in data being saved to the database.
Propel requires the magic_quotes_gpc php.ini setting to be Off. You can set this globally in your php.ini, or local to your webapp using Propel via Apache php_value directive (or the registry, if using Windows+IIS).
Propel isn't auto-incrementing my primary key!
Usually this is because you didn't tell Propel to auto-increment your primary key. Make sure that you specify autoIncrement="true" on your column, in addition to primaryKey="true":
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true"/>
I get a "No connection params for 'my_db_name'" exception
Generally this exception points to a mismatch in your build and runtime information for Propel. Bear in mind that Propel doesn't actually care about the actual name of your RDBMS database, but it does need to have a name to reference the connection parameters.
1. Check to make sure that your database name is specified in your schema.xml
<database name="my_db_name" defaultIdMethod="native"> <!-- table definitions here --> </database>
You can verify that the classes are being built correctly by opening up one of the base classes and checking the value for the DATABASE_NAME constant. It should be "my_db_name" in this example.
2. Check to make sure that you have used the same name in your runtime-conf.xml. Propel will use that DATABASE_NAME constant to lookup the connection params, so it's important that you use the same name.
<propel> <datasources default="my_db_name"> <datasource id="my_db_name"> <!-- adapter & DSN config --> </datasource> </datasources> </propel>
Finally, you should also make sure that you have compiled that runtime-conf.xml file and that you have called initialized Propel with the [latest & correct] compiled version.
Dates in MSSQL are off by 1 month
This is apparently a problem when accessing MSSQL from Linux (using the FreeTDS driver). Sandro Souza explains:
...under linux the driver for mssql is SYBASE alias, and FreeTDS is set to work with SYBASE by default. The problem is that sybase counts months from 0 to 11, and mssql from 1 to 12. that´s the cause of that strange one month less. To correct this, u have to compile FreeTDS with a "--enable-msdblib".
Errors about timezone settings in PHP 5.1
In PHP 5.1 you may see runtime (or build-time) errors that look like: It is not safe to rely on the systems timezone settings, please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We now use ..... This is not a bug in Propel; as of PHP 5.1 you must set the timezone to be used by your PHP application in one of the ways suggested by the error message. See this manual page for some more information about timezone in PHP 5.1: http://www.php.net/date-default-timezone-get
