<commit_before><?php

/**
 * Defines the data model for the SiteSprocket order interface
 *
 * @package SiteSprocket
 * @author <NAME>
 */
class SiteSprocket extends Page
{

	static $has_many = array (
		'ProductGroups' => 'SiteSprocketProductGroup',
		'ProductOptions' => 'SiteSprocketProductOption'
	);
	
	
	public function getCMSFields() {
		$f = parent::getCMSFields();
		$f->addFieldToTab("Root.Content.Product Options", new DataObjectManager($this, 'ProductOptions','SiteSprocketProductOption'));
		$f->addFieldToTab("Root.Content.Product G", new DataObjectManager($this, 'ProductGroups','SiteSprocketProductGroup'));
		$f->addFieldToTab("Root.Content.On Submit", new HtmlEditorField('OnSubmit', _t('SSP.ONSUBMIT','On submit text')));
		return $f;
	}
}


/**
 * Defines the controller for all frontend functions and views for the SiteSprocket<commit_msg>SAMPLE - Couple of sample onBeforeDelete methods that get rid of extraneous product option groups<commit_after><?php

/**
 * Defines the data model for the SiteSprocket order interface
 *
 * @package SiteSprocket
 * @author <NAME>
 */
class SiteSprocket extends Page
{

	static $has_many = array (
		'ProductGroups' => 'SiteSprocketProductGroup',
		'ProductOptions' => 'SiteSprocketProductOption'
	);
	
	
	public function getCMSFields() {
		$f = parent::getCMSFields();
		$f->addFieldToTab("Root.Content.Product Options", new DataObjectManager($this, 'ProductOptions','SiteSprocketProductOption'));
		$f->addFieldToTab("Root.Content.Product G", new DataObjectManager($this, 'ProductGroups','SiteSprocketProductGroup'));
		$f->addFieldToTab("Root.Content.On Submit", new HtmlEditorField('OnSubmit', _t('SSP.ONSUBMIT','On submit text')));
		return $f;
	}
	
	public function onBeforeDelete() {
		parent::onBeforeDelete();
		foreach($this->ProductGroups() as $group) {
			$group->delete();
		}
	}
	
	public function onBeforeDelete() {
		parent::onBeforeDelete();
		$this->destroy();
	}
}


/**
 * Defines the controller for all frontend functions and views for the SiteSprocket
{'fraction_non_alphanumeric': 0.13723561239547466, 'fraction_numerical': 0.0, 'mean_word_length': 5.668852459016393, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 18, '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': '2212783', 'n_tokens_mistral': 676, 'n_tokens_neox': 624, 'n_words': 147}