<commit_before><?php

require_once ('BasicJoinTable.php');

class ManyToMany extends Relationship
{
	protected $joinTable = null;
	protected $joinTableSourceJoin;
	protected $joinTableTargetJoin;
	protected $many = null;

	public function __construct($source, $sourceJoin, $target, $targetJoin, $joinTable, $joinTableSourceJoin, $joinTableTargetJoin) {
		$this->source = $source;
		$this->sourceField = $sourceJoin;
		$this->target = $target;
		$this->targetField = $targetJoin;
		$this->joinTable = $joinTable;
		$this->joinTableSourceJoin = $joinTableSourceJoin;
		$this->joinTableTargetJoin = $joinTableTargetJoin;
	}

	protected function load($reload = false) {
		if ($this->many && !$reload) {
			return;
		}

		if (!$this->many) {
			$this->many = array();
		}

		$source = $this->source;
		$sourceJoinField = $this->sourceField;
		$sourceJoinValue = $source->$sourceJoinField;

		$joinTableSourceJoin = $this->joinTableSourceJoin;
		$joinTableTargetJoin = $this->joinTableTargetJoin;

		// Setup a joinTable to load many-to-many
		$joinTable = new BasicJoinTable($this->joinTable);
		$joinTable->$joinTableSourceJoin = "mario";
		$joinTable->$joinTableTargetJoin = null;

		$filter = array('eq' => array($joinTableSourceJoin => $sourceJoinValue));
		$list = $joinTable->fetchAllFiltered($filter);<commit_msg>Removed debug code from ManyToMany relationship<commit_after><?php

require_once ('BasicJoinTable.php');

class ManyToMany extends Relationship
{
	protected $joinTable = null;
	protected $joinTableSourceJoin;
	protected $joinTableTargetJoin;
	protected $many = null;

	public function __construct($source, $sourceJoin, $target, $targetJoin, $joinTable, $joinTableSourceJoin, $joinTableTargetJoin) {
		$this->source = $source;
		$this->sourceField = $sourceJoin;
		$this->target = $target;
		$this->targetField = $targetJoin;
		$this->joinTable = $joinTable;
		$this->joinTableSourceJoin = $joinTableSourceJoin;
		$this->joinTableTargetJoin = $joinTableTargetJoin;
	}

	protected function load($reload = false) {
		if ($this->many && !$reload) {
			return;
		}

		if (!$this->many) {
			$this->many = array();
		}

		$source = $this->source;
		$sourceJoinField = $this->sourceField;
		$sourceJoinValue = $source->$sourceJoinField;

		$joinTableSourceJoin = $this->joinTableSourceJoin;
		$joinTableTargetJoin = $this->joinTableTargetJoin;

		// Setup a joinTable to load many-to-many
		$joinTable = new BasicJoinTable($this->joinTable);
		$joinTable->$joinTableSourceJoin = null;
		$joinTable->$joinTableTargetJoin = null;

		$filter = array('eq' => array($joinTableSourceJoin => $sourceJoinValue));
		$list = $joinTable->fetchAllFiltered($filter);
{'fraction_non_alphanumeric': 0.14505824877865464, 'fraction_numerical': 0.0, 'mean_word_length': 5.461165048543689, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '5754606', 'n_tokens_mistral': 903, 'n_tokens_neox': 838, 'n_words': 166}