| 1 |
|
|---|
| 2 |
P R O P E L R E A D M E |
|---|
| 3 |
======================== |
|---|
| 4 |
|
|---|
| 5 |
This is Propel's php4 version 1.1.0beta1. |
|---|
| 6 |
|
|---|
| 7 |
1. Requirements |
|---|
| 8 |
2. Supported RDBMS |
|---|
| 9 |
3. Differences to Propel-5 |
|---|
| 10 |
3.1 Error handling |
|---|
| 11 |
3.2 Accessing constants |
|---|
| 12 |
3.3 Optional parameters |
|---|
| 13 |
|
|---|
| 14 |
1. Requirements |
|---|
| 15 |
|
|---|
| 16 |
The backport of Propel does only include the runtime classes. |
|---|
| 17 |
Propel's generator framework has not been backported yet - basically because of its |
|---|
| 18 |
dependency on Phing. So, for generating your OM classes for php4 you need a recent php5 |
|---|
| 19 |
commandline executable, unfortunately. |
|---|
| 20 |
|
|---|
| 21 |
Further requirements: |
|---|
| 22 |
|
|---|
| 23 |
- Phing: project build system based on Apache Ant used by Propel's generator framework. |
|---|
| 24 |
Download version 2.0.0 from http://phing.info/wiki/index.php?node=2 |
|---|
| 25 |
- Creole-5: database abstraction layer used by Propel. |
|---|
| 26 |
You'll need to download a version >= 1.0.1 from http://creole.tigris.org. |
|---|
| 27 |
- Propel-5: for generating the om classes. |
|---|
| 28 |
You'll need to download a version >= 1.1.0 from http://propel.tigris.org. |
|---|
| 29 |
|
|---|
| 30 |
See the INSTALL file for a quick guide for installing Propel-5 and building your |
|---|
| 31 |
om classes. |
|---|
| 32 |
|
|---|
| 33 |
2. Supported RDBMS |
|---|
| 34 |
================== |
|---|
| 35 |
|
|---|
| 36 |
Propel-4 currently supports |
|---|
| 37 |
- MySQL, |
|---|
| 38 |
- PostgreSQL |
|---|
| 39 |
- SQLite |
|---|
| 40 |
- MS SQL Server |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
3. Differences to Propel-5 |
|---|
| 44 |
========================== |
|---|
| 45 |
|
|---|
| 46 |
Propel-4 tries to be as equal as possible to Propel-5. |
|---|
| 47 |
Due to major changes in php5 this is not always possible, though. |
|---|
| 48 |
Below is a list of main differences between both implementations. |
|---|
| 49 |
|
|---|
| 50 |
3.1 Error handling |
|---|
| 51 |
------------------ |
|---|
| 52 |
|
|---|
| 53 |
Propel-4 uses the same exception classes which are known from Propel-5. |
|---|
| 54 |
The difference in Propel-4 is that exceptions are returned instead of thrown. |
|---|
| 55 |
This means that all class methods throwing an exception in Propel-5 return an exception class in Propel-4. |
|---|
| 56 |
Creole-4 and Propel-4 have a static method called isError, respectively. |
|---|
| 57 |
This method is used to check whether a return value is an exception. |
|---|
| 58 |
|
|---|
| 59 |
- Creole::isError($value) checks for exceptions returned by the creole layer (e.g. SQLException) |
|---|
| 60 |
- Propel::isError($value) checks for exceptions returned by propel itself (e.g. PropelException) |
|---|
| 61 |
|
|---|
| 62 |
Example: $criteria = new Criteria(); |
|---|
| 63 |
$criteria->addAscendingOrderByColumn(AuthorPeer::LAST_NAME()); |
|---|
| 64 |
|
|---|
| 65 |
$rs =& AuthorPeer::doSelect($criteria); |
|---|
| 66 |
if(Propel::isError($rs)) { die($rs->getMessage()); } |
|---|
| 67 |
|
|---|
| 68 |
3.2 Accessing constants |
|---|
| 69 |
----------------------- |
|---|
| 70 |
|
|---|
| 71 |
Propel-5 constants like in the generated Peer classes or Criteria are static class methods in Propel-4. |
|---|
| 72 |
|
|---|
| 73 |
Example: $criteria = new Criteria(); |
|---|
| 74 |
$criteria->add(AuthorPeer::LAST_NAME(), "John", Criteria::EQUAL()); |
|---|
| 75 |
|
|---|
| 76 |
3.3 Optional parameters |
|---|
| 77 |
----------------------- |
|---|
| 78 |
|
|---|
| 79 |
Optional parameters in Propel-5 are most likely used for passing a different Connection object to a |
|---|
| 80 |
class method. Since those Connection objects have to be passed as reference in Propel-4 this is not |
|---|
| 81 |
possible offhand. Therefore a new class Param has been introduced which is used to pass the |
|---|
| 82 |
connection as reference to the appropriate method. |
|---|
| 83 |
|
|---|
| 84 |
Example: $con =& Propel::getConnection(); |
|---|
| 85 |
$rs =& AuthorPeer::doSelect(new Criteria(), Param::set($con)); |
|---|
| 86 |
|
|---|
| 87 |
With Param::set() a reference to $con is stored inside the Param object. |
|---|
| 88 |
The Param object itself is passed by value. However, php keeps the reference to the connection |
|---|
| 89 |
and inside doSave this reference is retrieved using the Param::get() method. |
|---|