[ciapug] Propel
carl-olsen at mchsi.com
carl-olsen at mchsi.com
Mon Jan 7 14:34:10 CST 2008
I finally got Propel working and it looks like it's going to be extremely useful. I did have to do a lot of tweaking because of the location of my files in subdirectories. I came up with a crazy looking autoload function:
function __autoload($class_name)
{
$tools = "C:/php/PEAR/";
$tooldir = array();
$tooldir[] = "propel/";
$tooldir[] = "propel/util/";
foreach($tooldir as $key => $sub)
{
if (file_exists($tools . $sub . $class_name . ".php"))
{
require_once($sub . $class_name . ".php");
}
}
$base = "C:/PropelWorkspace/PropelProject/phpinclude/";
$subdir = array();
$subdir[] = "admission/ugrad/admission/sforms/build/classes/sforms/";
$subdir[] = "admission/ugrad/admission/sforms/build/classes/sforms/map/";
$subdir[] = "admission/ugrad/admission/sforms/build/classes/sforms/om/";
foreach($subdir as $key => $sub)
{
if (file_exists($base . $sub . $class_name . ".php"))
{
require_once($sub . $class_name . ".php");
}
}
}
I also ran into errors because I didn't have the PEAR Log package installed. Installing it was fairly simple "pear install log", but when you have no idea what you are doing even something simple like that can be a challenge. I also added some include_path statements to my php.ini file. I also had to modify the paths inside the class files that propel generated. I probably made more work for myself than necessary, but everything is working and I have objects that are passing information back and forth with the database. Propel generates all the object classes and creates the tables in the database automatically.
Carl
More information about the ciapug
mailing list