<commit_before><?php
namespace App\Controller;

use App\Controller\AppController;
use Cake\Event\Event;

/**
 * CharactersPowers Controller
 *
 * @property App\Model\Table\CharactersPowersTable $CharactersPowers
 */
class CharactersPowersController extends AppController {

	public function initialize() {
		parent::initialize();

		$this->Crud->mapAction('charactersIndex',
			[ 'className' => 'Crud.Index'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);
		$this->Crud->mapAction('charactersView',
			[ 'className' => 'Crud.View'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);
		$this->Crud->mapAction('charactersEdit',
			[ 'className' => 'Crud.Edit'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);

		$this->Crud->mapAction('powersIndex',
			[ 'className' => 'Crud.Index'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);
	}

	public function charactersIndex($plin, $chin) {
		$this->loadModel('Characters');
		$parent = $this->Characters->plinChin($plin, $chin);
		$this->set('parent', $parent);

		$this->Crud->on('beforePaginate',
			function(Event $event) use ($id) {
				$event->subject->query->where(['character_id' => $parent->id]);
		});
		return $this->Crud->execute();
	}
	public function charactersView($plin, $chin, $poin) {
		$this->Crud->on('beforeHandle', function(Event $event) {
			$event->subject->args = $this->argsCharId($event->subject->args);
		});
		return $this->Crud->execute();
	}
	public function charactersEdit($plin, $chin, $poin) {
		return $this->charactersView($plin, $chin, $poin);
	}

	public function powersIndex($poin) {
		$this->loadModel('Powers');
		$this->set('parent', $this->Powers->get($poin));

		$this->Crud->on('beforePaginate',
			function(Event $event) use ($poin) {
				$event->subject->query->where(['power_id' => $poin]);
		});
		return $this->Crud->execute();
	}
}<commit_msg>missed a $id => $parent<commit_after><?php
namespace App\Controller;

use App\Controller\AppController;
use Cake\Event\Event;

/**
 * CharactersPowers Controller
 *
 * @property App\Model\Table\CharactersPowersTable $CharactersPowers
 */
class CharactersPowersController extends AppController {

	public function initialize() {
		parent::initialize();

		$this->Crud->mapAction('charactersIndex',
			[ 'className' => 'Crud.Index'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);
		$this->Crud->mapAction('charactersView',
			[ 'className' => 'Crud.View'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);
		$this->Crud->mapAction('charactersEdit',
			[ 'className' => 'Crud.Edit'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);

		$this->Crud->mapAction('powersIndex',
			[ 'className' => 'Crud.Index'
			, 'contain' => [ 'Characters', 'Powers' ]
			]);
	}

	public function charactersIndex($plin, $chin) {
		$this->loadModel('Characters');
		$parent = $this->Characters->plinChin($plin, $chin);
		$this->set('parent', $parent);

		$this->Crud->on('beforePaginate',
			function(Event $event) use ($parent) {
				$event->subject->query->where(['character_id' => $parent->id]);
		});
		return $this->Crud->execute();
	}
	public function charactersView($plin, $chin, $poin) {
		$this->Crud->on('beforeHandle', function(Event $event) {
			$event->subject->args = $this->argsCharId($event->subject->args);
		});
		return $this->Crud->execute();
	}
	public function charactersEdit($plin, $chin, $poin) {
		return $this->charactersView($plin, $chin, $poin);
	}

	public function powersIndex($poin) {
		$this->loadModel('Powers');
		$this->set('parent', $this->Powers->get($poin));

		$this->Crud->on('beforePaginate',
			function(Event $event) use ($poin) {
				$event->subject->query->where(['power_id' => $poin]);
		});
		return $this->Crud->execute();
	}
}
{'fraction_non_alphanumeric': 0.21316783594171615, 'fraction_numerical': 0.0, 'mean_word_length': 4.67687595712098, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 106, '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': '7311630', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1292, 'n_words': 201}