Standalone Project Directories
If you're using any non-PEAR version of Propel (ordinary zip/tarball release or SVN version), you might be missing a unique feature of the PEAR version - the ability to place a project in whatever directory you prefer. Usually, projects you want to build have to reside inside the "generator/projects/" folder. As of Propel 1.2, you have the ability to store and build a project from outside Propel's directory structure.
How It Works
The PEAR version of Propel ships with a script called "propel-gen". It sits inside your PEAR folder, which itself is in your environment's lookup path (and in PHP's include_path). The script "knows" where Propel is installed - inside the PEAR folder in your system. This way, whenever you call "propel-gen yourproject", it knows the "home" location of Propel itself and can do it's job. SVN and downloadable release versions of Propel don't have this benefit. You can install them whereever you like, ship them along with your project etc. While this has some substantial benefits (for instance, you can "force" the use of a certain version of Propel by bundling it with your product), a little more effort is needed to make projects build from outside your Generator projects folder. By using a modified "build.xml" file and specifying some more properties in your "build.properties" file, we can make it work.
Easy Stuff!
The first thing you need to do is to copy the "build.xml-local" file (which is sitting inside your "propel-generator" root directory) to your project directory and rename it to "build.xml". After you're done, open your project's "build.properties" file and insert these properties:
propel.home = /path/to/propel/generator/directory propel.schema.dir = . propel.conf.dir = . propel.output.dir = ./build
You can use both absolute and relative paths. In the example above, schema and config dirs are set to "." (you shouldn't have to change this). All output will be written to a folder called "build" inside your project dir. You can fine-tune this output behavior even further, like this, for instance:
propel.output.dir = ../..
propel.php.dir = ${propel.output.dir}/webapp/lib
propel.phpconf.dir = ${propel.output.dir}/webapp/config
propel.sql.dir = ${propel.output.dir}/dev/sql
Don't forget to specify a "propel.project" directive (you can't live without it anyway, usually). Also, setting a "propel.targetPackage" often makes sense
Let's Rock!
That should do the job. Change to your project directory and call "phing" (or "phing -Dproject=yourproject", or, of course "phing <target>").
Another Tip
When you are using this approach, you often do not have neither Propel nor Creole in your PHP include_path. However, to build a project, Propel generator needs Creole. If you don't want to mess around with your include path (or if you can't!), there's an easy way out: copy the "creole" folder (the one that contains "Creole.php" and the other files) to your "propel-generator/classes/" directory.
