1. General
    1. Why are the build.properties and runtime-conf.xml properties separate?
    2. Does Propel support caching?
    3. How does Propel handle id generation (like auto-increment)?
    4. Why does Propel use Creole instead of something more popular like …
    5. What are the differences between Propel and Apache Torque?
    6. Does Propel support Views
    7. How can I avoid that timestamps are added to the Base* classes - esp. when …
  2. DB-specific Issues
    1. Is a specific MySQL version required?
    2. Do I need to use InnoDB tables with MySQL?
    3. Do I need to do enclose BLOB/CLOB queries in transactions for PostgreSQL?
  3. Comments
      1. Comment by sean@copiousinc.com on Wed Mar 22 18:14:00 2006
      2. Comment by anonymous on Wed Apr 5 07:10:21 2006
      3. Comment by anonymous on Tue Apr 11 13:59:24 2006
      4. Comment by anonymous on Tue Apr 11 15:25:18 2006
      5. Comment by q-snick@mail.ru on Fri Apr 28 08:28:56 2006
      6. Comment by anonymous on Fri May 5 20:32:00 2006
      7. Comment by anonymous on Fri May 5 21:33:40 2006
      8. Comment by anonymous on Fri May 19 01:43:32 2006
      9. Comment by anonymous on Wed Jun 14 14:40:21 2006
      10. Comment by anonymous on Thu Jun 15 15:57:23 2006
      11. Comment by anonymous on Thu Jun 15 15:59:31 2006
      12. Comment by ccfunny@rambler.ru on Thu Jul 13 12:02:38 2006
      13. Comment by anonymous on Fri Jul 14 15:27:10 2006
      14. Comment by anonymous on Sat Jul 15 12:41:37 2006
      15. Comment by anonymous on Sat Jul 15 12:44:13 2006
      16. Comment by dmd on Thu Jul 20 09:10:58 2006
      17. Comment by anonymous on Thu Jul 27 19:49:09 2006
      18. Comment by LostWithSybase on Thu Jul 27 19:49:53 2006
      19. Comment by ChicoDiCherry on Thu Aug 3 09:47:03 2006
      20. Comment by anonymous on Sat Aug 12 13:30:04 2006
      21. Comment by anonymous on Sun Aug 13 22:40:29 2006
      22. Comment by anonymous on Wed Aug 16 22:42:45 2006
      23. Comment by anonymous on Thu Aug 17 10:28:03 2006
      24. Comment by anonymous on Thu Aug 17 10:38:22 2006
      25. Comment by anonymous on Thu Aug 17 10:38:38 2006
      26. Comment by anonymous on Thu Aug 17 11:57:20 2006

Frequently Asked Questions

This is a work in progress. If you have a question that you think would benefit others using Propel, please add it to the comments and we will address it in this FAQ. If your problem is more of a "why is this breaking?!" issue then you may find your answer in the WTF document.

If you have a question that is not listed here, please consider asking the user mailing-list.

General

Why are the build.properties and runtime-conf.xml properties separate?

build.properties is where you define build properties, while the runtime-conf.xml file is where you define runtime properties. Usually these files will contain some duplicate information -- in particular, the database connection information will probably be the same (but it doesn't have to be). Note that the runtime erties file needs values in a slightly different fromat (PEAR-style DSN) than the build properties. The runtime properties file is turned into a multi-dimensional PHP assoc array by a Phing task. When you initialize Propel you pass the path to the converted file (by default the converted file is placed in the build/conf directory).

Does Propel support caching?

Propel does not support caching of loaded objects. Torque does support caching through Manager classes, but these have not been included in Propel: it was felt that Managers would not add significant performance benefit in a PHP environment.

Of course, you can always override methods like doSelect() in your Peer class to implement your own caching model.

How does Propel handle id generation (like auto-increment)?

Propel supports only native id generation. That means that for MySQL Propel will use AUTO_INCREMENT, IDENTITY() for MS SQL Server, CREATE SEQUENCE ... for PostgreSQL, etc.

For those familiar with how Torque does things, it's worth noting that we abandoned the Turbine ID-BROKER system because sequence/auto-increment support exists natively in the db backends we plan to support.

Why does Propel use Creole instead of something more popular like PEAR::DB, MDB, ADOdb, or Metabase?

We would have loved to use existing technology rather than spawn a new project, but quite simply none of the other projects have the features Propel needs.

Mostly importantly, Propel needs a datatype abstraction system -- so that generic types can be mapped to native database types. Propel needed a richer set of types than the very basic selection offered by MDB/Metabase or ADOdb, which offer a mapping of PHP types (there aren't many of those) to SQL types.

Relatedly, Propel needed a system that was able to properly prepare different types of data (especially date/time columns, BOOLEAN, BLOB) for the specific RDBMS. Creole handles native PHP dates (unix timestamp) and puts them in the right format for the target database.

Propel also requires a good metadata system to handle reverse-engineering databases. Some of the current layers have some basic metadata support, but we were not able to find anything that had comprehensive metadata support (e.g. full column info, indexes, foreign keys, primary key info).

Finally, Propel is also written for PHP5 and needed a system that could take advantage of the language's new features -- especially exceptions.

Update: Propel will be using PDO in version 1.3 and onward. The metadata components of Creole will be refactored into a new package.

What are the differences between Propel and Apache Torque?

Propel is a port of Torque (which is written in Java); the schema is almost the same and much of the codebase design is very similar. Of course Propel is written in PHP so there are many obvious differences, but there are also some changes that were made that are worth pointing out:

  • Propel does not support Torque's "id-broker" method of generating auto-increment ids. The "id-broker" method is essentially what layers like DB, MDB, and ADOdb use to emulate auto-increment/sequences in a db-uniform way. These layers create a new table for every sequence needed. Propel does not support "id-broker" because it uses native id generation, which is available for every supported driver.
  • Propel adds support for cascading deletes in databases that don't support them (e.g. MySQL, SQLite). Propel also supports ON CASCADE SET NULL in the same way.
  • Propel has column validators, based loosely (as I understand it) on the Turbine Intake validation system.
  • Propel-generated classes have smart date-time getters/setters that can format return values and handle most date/time input strings (or unix timestamps).
  • Propel-generated classes have smart methods to handle setting and retrieving BLOB/CLOB data.
  • Propel-generated classes hydrate objects without calling the setter methods and creates save queries withot calling the getter methods. This has the implication that the setter methods and getter methods are only for handling data to calling code & from calling code -- making it possible to add filtering and validation in these methods, which is not possible in Torque which uses the same methods to handle reading/writing db rows.

Other than that, there have been some more minor design changes, many simplifications for the sake of PHP performance, and a general tendency to move the low-level functionality into the Creole layer.

Does Propel support Views

Propel handles views like normal tables, so you can use them, too. But to check if your views are updatable, and not read-only, consult your database documentation.

How can I avoid that timestamps are added to the Base* classes - esp. when commiting to a SCM

Just set

propel.addTimeStamp = false

in your build.properties

DB-specific Issues

Is a specific MySQL version required?

Propel is designed for MySQL 4.0.x. It works also with the newer 4.1.x and 5.0.x versions, although it does not take advantage of any of the new features or fixes in this branch (although 5.x views should work). It probably will not work w/o modification with the older 3.x versions.

Do I need to use InnoDB tables with MySQL?

No. We defaulted to InnoDB table types in early Propel release just because these table types offer true foreign key constraints and transaction support. Obviously supporting transactions and fkey constraints has its advantages for Propel, but you are able to use MySQL's native (and faster) MyISAM table types. This is probably a good idea if your application is primarily using Propel for reading data. To change the table type, specify a value for propel.mysql.tableType property in your build.properties file.

Do I need to do enclose BLOB/CLOB queries in transactions for PostgreSQL?

No. Propel will automatically start and commit the transaction if you are using PostgreSQL and are performing a query which involves a LOB column.


Comments

Comment by sean@copiousinc.com on Wed Mar 22 18:14:00 2006

Does Propel support continuous connections, or does it have to authenticate and connect for every query. I am assuming that the a connection is created when Propel::init is called, but how long does the connection persist.

Currently not, but would be easy to implement because underlying creole supports it.

Is it possible to specify in your schema.xml multiple table types, such as: InnoDB and MyISAM, in the same database?

Yes, pls check schema.xml reference.

Comment by anonymous on Wed Apr 5 07:10:21 2006

Does propel support replicated databases between multiple backend DB machines?

Yes, with a little manual work - check the howtos.

Comment by anonymous on Tue Apr 11 13:59:24 2006

Why does propel make integer fields when I use "BOOLEAN" type?

Comment by anonymous on Tue Apr 11 15:25:18 2006

when i try to create the schema.xml file i get the error 'no input type specified'

do you know what this means??

Comment by q-snick@mail.ru on Fri Apr 28 08:28:56 2006

Does propel is able to generate schema.xml from existing database?

Yes, please read the doc and howtos carefully (and look for `creole' target)

Comment by anonymous on Fri May 5 20:32:00 2006

Is it possible to set the character set or collate for tables?

Comment by anonymous on Fri May 5 21:33:40 2006

Isn't there text datatypes on schema.xml?

Comment by anonymous on Fri May 19 01:43:32 2006

çfdlçflçg çgd

Comment by anonymous on Wed Jun 14 14:40:21 2006

How can I retrieve ONLY ONE column of a table using PEER? Good programmers usually never make things like SELECT * FROM...

Comment by anonymous on Thu Jun 15 15:57:23 2006

Retrieve only one column:

$m_criteria = new Criteria(); $m_criteria->clearSelectColumns()->addSelectColumn(YourjobjectnamePeer::COL_NAME); $rs = BasePeer::doSelect($m_criteria); while ($rs->next()) {

echo $rs->get(1);

}

Comment by anonymous on Thu Jun 15 15:59:31 2006

Retrieve only one column:

$m_criteria = new Criteria();
$m_criteria->clearSelectColumns()->addSelectColumn(YourjobjectnamePeer::COL_NAME);
$rs = BasePeer::doSelect($m_criteria);
while ($rs->next()) {
  echo $rs->get(1);
}

This comment script is broken.

Comment by ccfunny@rambler.ru on Thu Jul 13 12:02:38 2006

Why propel convert the column names from schema.xml in uppercase(when i generate a classes)?

Comment by anonymous on Fri Jul 14 15:27:10 2006

Add the defaultPhpNamingMethod="noChange" as below.

<database name="dbName" defaultPhpNamingMethod="nochange">

Comment by anonymous on Sat Jul 15 12:41:37 2006

Is propel mapping equal to torque.

That is, if I want to build an OO Website in php and an OO Desktop Application in Java can I use both database mappings as the same?

Comment by anonymous on Sat Jul 15 12:44:13 2006

Is propel mapping equal to torque.

That is, if I want to build an OO Website in php and an OO Desktop Application in Java can I use both database mappings as the same?

Comment by dmd on Thu Jul 20 09:10:58 2006

ok. What about Sybase ASE? I change MSSQL driver and now i can generate schema.xml file from DB and after that generate a base classes for my DB from schema. But ASE is case sensitive. And when i have a column name in mixed case - our classes can't work with DB. Because in generated peer classes all columns names (values of constants) named in upper case. I can resolve this trouble by new builder classes which extends a standart builder classes. But in this case i can makes only insert and select with DB. But during delete operation, "normalizeColName" methods from TableMap class caused, which directly convert column name to upper case. I need that generated SQL by propel will contain fields name in lower case. How I can resolve this problem? Thanks.

Comment by anonymous on Thu Jul 27 19:49:09 2006

How can u make a select with left joins and a complex ON clause?!?

for example

SELECET
   *
FROM
      table_a as a
   LEFT JOIN
      table_b as b
         ON a.bid = b.id AND b.langid = 2 or b.langid = 0
WHERE
   a.name = 'somename'

how can u produce with the criteria class the on clause?!? ON a.bid = b.id AND b.langid = 2 or b.langid = 0

Comment by LostWithSybase on Thu Jul 27 19:49:53 2006

Can someone please inform me of what the build.properties file would look like for Sybase?

propel.database.driver = creole.drivers.mssql.MSSQLConnection
propel.driver = co
propel.project = dbname
propel.database.dbname.adapter = DBSybase
propel.database = sybase
propel.database.url = sybase://dbservername

Is that the correct syntax?

Comment by ChicoDiCherry on Thu Aug 3 09:47:03 2006

hi how can i submit a ticket here?!?

bug in generating sql sript on generation propel does not chek, if u define keys for example unique keys for a table if the reference on the coulm is correct or not.

Comment by anonymous on Sat Aug 12 13:30:04 2006

<u style="display: none;">... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... <a href='http://www.ringtones-dir.com'>free ringtones</a> : download ringtones - download ringtones : [nokia ringtones|http://www.ringtones-dir.com] - [nokia ringtones|HTTP://www.ringtones-dir.com] : http://www.ringtones-dir.com/download/ : [ring tones] : [| ringtones download] : "samsung ringtones" http://www.ringtones-dir.com : free </u>

Comment by anonymous on Sun Aug 13 22:40:29 2006

<u style="display: none;">... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... <a href='http://www.ringtones-rate.com'>mp3 ringtones</a> : real ringtones - real ringtones : [motorola ringtones|http://www.ringtones-rate.com] - [motorola ringtones|HTTP://www.ringtones-rate.com] : http://www.ringtones-rate.com/tones/ : [tracfone ringtones] : [| qwest ringtones] : "nextel ringtones" http://www.ringtones-rate.com : ringtones </u>

Comment by anonymous on Wed Aug 16 22:42:45 2006

Hi,

is it possible to generate data in xml format ?

Comment by anonymous on Thu Aug 17 10:28:03 2006

Hi All,

How to do i set Build Configuration to connect to mysql database?

i am not sure how to edit the following :

# The name of the project 
propel.project = bookstore
 
# The database driver 
propel.database = sqlite

# The connection parameters (optional)
propel.database.url = sqlite:///path/to/bookstore.db
#              note 3 slashes ^   (sqlite:// + /path/to/bookstore.db)

I really want to see what propel can do for me.. Thanks,

www.cyberdesigns.co.za

www.jumpingbean.co.za

Comment by anonymous on Thu Aug 17 10:38:22 2006

Hi All,

How to do i set Build Configuration to connect to mysql database?

i am not sure how to edit the following :

# The name of the project 
propel.project = bookstore
 
# The database driver 
propel.database = sqlite

# The connection parameters (optional)
propel.database.url = sqlite:///path/to/bookstore.db
#              note 3 slashes ^   (sqlite:// + /path/to/bookstore.db)

I really want to see what propel can do for me.. Thanks,

www.cyberdesigns.co.za

www.jumpingbean.co.za

Comment by anonymous on Thu Aug 17 10:38:38 2006

Hi All,

How to do i set Build Configuration to connect to mysql database?

i am not sure how to edit the following :

# The name of the project 
propel.project = bookstore
 
# The database driver 
propel.database = sqlite

# The connection parameters (optional)
propel.database.url = sqlite:///path/to/bookstore.db
#              note 3 slashes ^   (sqlite:// + /path/to/bookstore.db)

I really want to see what propel can do for me.. Thanks,

www.cyberdesigns.co.za

www.jumpingbean.co.za

Comment by anonymous on Thu Aug 17 11:57:20 2006

Hi All,

How to do i set Build Configuration to connect to mysql database?

i am not sure how to edit the following :

# The name of the project 
propel.project = bookstore
 
# The database driver 
propel.database = sqlite

# The connection parameters (optional)
propel.database.url = sqlite:///path/to/bookstore.db
#              note 3 slashes ^   (sqlite:// + /path/to/bookstore.db)

I really want to see what propel can do for me.. Thanks,