<commit_before><?php

abstract class _ORM_Model {

	const RELA_PREFIX = '_r_';
	const PROP_PREFIX = '_p_';
	const OBJ_NAME_SUFFIX = '_name';
	const OBJ_ID_SUFFIX = '_id';
	const JSON_SUFFIX = '_json';

	private $_name;
	private $_data = array('id'=>0);
	private $_update = array();
	private $_objects = array();
	
	private $_O;	
	function __sleep() {
		$this->_O = array(
			'name'=>$this->_name,
			'id'=>$this->id,
		);
		return array("\0_ORM_Model\0_O");
	}

	function __wakeup() {
		$name = $this->_O['name'];
		$id = $this->_O['id'];
		
		if ( !$name) return;

		$object = self::factory($name, $id);

		$this->_data = $object->_data;
		$this->_objects = array();
		$this->_update = array();
		$this->_name = $object->_name;
		
		$this->init();
	}

	function __clone()
	{
		/* NO.BUG #190 (xiaopei.li@2010.11.26) */
		$this->_objects=array();
		$this->_data['id'] = 0;
		$this->_update=$this->_data;

		$this->init();
		// clone扩展属性仍有问题
		// $extra_data = Properties::factory($this)->data();
		// if (is_array($extra_data)) {
		//  	$this->_update = array_merge($this->_update, $extra_data);
		// }<commit_msg>update orm to support __clone on extra_data<commit_after><?php

abstract class _ORM_Model {

	const RELA_PREFIX = '_r_';
	const PROP_PREFIX = '_p_';
	const OBJ_NAME_SUFFIX = '_name';
	const OBJ_ID_SUFFIX = '_id';
	const JSON_SUFFIX = '_json';

	private $_name;
	private $_data = array('id'=>0);
	private $_update = array();
	private $_objects = array();
	
	private $_O;	
	function __sleep() {
		$this->_O = array(
			'name'=>$this->_name,
			'id'=>$this->id,
		);
		return array("\0_ORM_Model\0_O");
	}

	function __wakeup() {
		$name = $this->_O['name'];
		$id = $this->_O['id'];
		
		if ( !$name) return;

		$object = self::factory($name, $id);

		$this->_data = $object->_data;
		$this->_objects = array();
		$this->_update = array();
		$this->_name = $object->_name;
		
		$this->init();
	}

	function __clone()
	{
		/* NO.BUG #190 (xiaopei.li@2010.11.26) */
		$extra_data = Properties::factory($this)->data();

		$this->_objects=array();
		$this->_data['id'] = 0;
		$this->_update = array_merge((array)$this->_data, (array)$extra_data);

		$this->init();
{'fraction_non_alphanumeric': 0.21500920810313076, 'fraction_numerical': 0.013812154696132596, 'mean_word_length': 3.8396436525612474, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4175575', 'n_tokens_mistral': 927, 'n_tokens_neox': 834, 'n_words': 160}