<commit_before><?php
/**
* AutoModeler
*
* @package        AutoModeler
* @author         <NAME>
* @copyright      (c) 2010 <NAME>
* @license        http://www.opensource.org/licenses/isc-license.txt
*/
class AutoModeler_Core extends Model_Database implements ArrayAccess
{
	const VERSION = '3.7.1';

	// The database table name
	protected $_table_name = '';

	// The database fields
	protected $_data = array();

	// Validation rules in a 'field' => 'rules' array
	protected $_rules = array();
	protected $_callbacks = array();

	protected $_validation = array();

	protected $_validated = FALSE;

	protected $_lang = 'form_errors';

	protected $_state = AutoModeler::STATE_NEW;

	const STATE_NEW = 'new';
	const STATE_LOADING = 'loading';
	const STATE_LOADED = 'loaded';
	const STATE_DELETED = 'deleted';

	// Lists available states for this model
	protected $_states = array(
		AutoModeler::STATE_NEW,
		AutoModeler::STATE_LOADING,
		AutoModeler::STATE_LOADED,
		AutoModeler::STATE_DELETED
	);

	/**
	 * Standard constructor, accepts an `id` column to look for
	 *
	 * @param string $id  an id to search for
	 *
	 */
	public function __construct($id = NULL)
	{
		parent::__construct($this->_db);

		if ($id !== NULL)
		{
			$this->load(db::select_array(array_keys($this->_data))->where($this->_table_name.'.id', '=', $id));
		}<commit_msg>Fix ambiguous column error when using with(). Fixes #26<commit_after><?php
/**
* AutoModeler
*
* @package        AutoModeler
* @author         <NAME>
* @copyright      (c) 2010 <NAME>
* @license        http://www.opensource.org/licenses/isc-license.txt
*/
class AutoModeler_Core extends Model_Database implements ArrayAccess
{
	const VERSION = '3.7.1';

	// The database table name
	protected $_table_name = '';

	// The database fields
	protected $_data = array();

	// Validation rules in a 'field' => 'rules' array
	protected $_rules = array();
	protected $_callbacks = array();

	protected $_validation = array();

	protected $_validated = FALSE;

	protected $_lang = 'form_errors';

	protected $_state = AutoModeler::STATE_NEW;

	const STATE_NEW = 'new';
	const STATE_LOADING = 'loading';
	const STATE_LOADED = 'loaded';
	const STATE_DELETED = 'deleted';

	// Lists available states for this model
	protected $_states = array(
		AutoModeler::STATE_NEW,
		AutoModeler::STATE_LOADING,
		AutoModeler::STATE_LOADED,
		AutoModeler::STATE_DELETED
	);

	/**
	 * Standard constructor, accepts an `id` column to look for
	 *
	 * @param string $id  an id to search for
	 *
	 */
	public function __construct($id = NULL)
	{
		parent::__construct($this->_db);

		if ($id !== NULL)
		{
			$this->load(db::select_array($this->fields())->where($this->_table_name.'.id', '=', $id));
		}
{'fraction_non_alphanumeric': 0.143646408839779, 'fraction_numerical': 0.005893186003683241, 'mean_word_length': 3.938181818181818, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '6316549', 'n_tokens_mistral': 932, 'n_tokens_neox': 860, 'n_words': 228}