问题
I'm new to using Propel ORM. I have generated code and am now trying to integrate the runtime with my PHP project. I am struggling with initializing the main Propel
class. It appears that the usage should be:
require_once('propel/runtime/lib/Propel.php');
Propel::configure('/path/to/runtime/config.php');
Propel::initialize();
I cannot find any documentation on what the contents on the runtime configuration should be, other than this:
http://www.propelorm.org/wiki/Documentation/1.6/RuntimeConfiguration
However, this document shows an XML file, not a PHP file. Any ideas?
回答1:
You need to actually run the generator on it like:
$ cd /path/to/project
$ propel-gen convert-conf
This will then parse the XML and convert it to the php array. This is all described in the Runtime Connection Settings section of the docs. You probably need to read the entire Build Time section though if you havent already.
回答2:
I wrote a HOWTO on getting started some while ago - perhaps that might be useful?
来源:https://stackoverflow.com/questions/7034908/propel-1-6-configuration-example