<commit_before><?

function __autoload($classname) {
	$filename = str_replace ('_', '/', $classname) . '.php';
	require_once $filename;
}

// include_once 'common.php';
$path = explode(PATH_SEPARATOR, get_include_path());
if (!in_array('f:/PEAR/pat', $path)) {
	$path[] = 'f:/PEAR/pat';
}
if (!in_array('f:/Q/lib/mod', $path)) {
	$path[] = 'f:/Q/lib/mod';
}
set_include_path(implode(PATH_SEPARATOR, $path));


// change these according to your propel settings
require_once 'bookstore/propel/BookPeer.php';
Propel::init('bookstore/propel/conf/propel.bookstore.php');
$object = BookPeer::retrieveByPK(1);
$path = './res';

// the rest should work out of the box if you don't have any unusal
// types in your database schema.xml (strings, int etc. should work)
$name = strtolower(get_class($object));
$definition = patForms_Definition_Propel::create(array(
	'name' => $name,
	'filename' => $path . '/form.' . $name . '.xml',
));

$form = &patForms::createCreator('Definition')->create($definition, $object);
$form->setRenderer(patForms::createRenderer('Array'));

$tpl = new patTemplate();
$tpl->setRoot($path);<commit_msg>Added a note on required packages/include_path<commit_after><?

function __autoload($classname) {
	$filename = str_replace ('_', '/', $classname) . '.php';
	require_once $filename;
}

/**
 * Required packages:
 *
 * - Propel Bookstore project (tested only with mysql, not sqlite)
 * - patForms (http://www.php-tools.net/site.php?file=patForms)
 * - patTemplate (http://www.php-tools.net/site.php?file=patTemplate)
 * - Xml_Serializer (http://pear.php.net/package/XML_Serializer)
 *
 * These need to be in your include_path, i.e. you'll most likely have
 * to at least add the pear/pat directory to the include path
 */


// change these according to your propel settings
require_once 'bookstore/propel/BookPeer.php';
Propel::init('bookstore/propel/conf/propel.bookstore.php');
$object = BookPeer::retrieveByPK(1);
$path = './res';


// the rest should work out of the box if you don't have any unusal
// types in your database schema.xml (strings, int etc. should work)
$name = strtolower(get_class($object));
$definition = patForms_Definition_Propel::create(array(
	'name' => $name,
	'filename' => $path . '/form.' . $name . '.xml',
));

$form = &patForms::createCreator('Definition')->create($definition, $object);
$form->setRenderer(patForms::createRenderer('Array'));

$tpl = new patTemplate();
$tpl->setRoot($path);
{'fraction_non_alphanumeric': 0.18032786885245902, 'fraction_numerical': 0.000819672131147541, 'mean_word_length': 5.164141414141414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7482208', 'n_tokens_mistral': 826, 'n_tokens_neox': 818, 'n_words': 193}