<commit_before><?php
namespace App\Controller\Admin;

use App\Controller\AppController;

/**
 * Wickets Controller
 *
 * @property App\Model\Table\WicketsTable $Wickets
 */
class WicketsController extends AppController {

/**
 * Index method
 *
 * @return void
 */
	public function index() {
		$this->paginate = [
			'contain' => [
				'PlayerLostWicket',
				'PlayerTookWicket',
				'PlayerBowledWicket',
				'Dismissals',
				'Innings'
			]
		];
		$this->set('wickets', $this->paginate($this->Wickets));
	}

/**
 * View method
 *
 * @param string $id
 * @return void
 * @throws \Cake\Network\Exception\NotFoundException
 */
	public function view($id = null) {
		$wicket = $this->Wickets->get($id, [
			'contain' => [
				'PlayerLostWicket',
				'PlayerTookWicket',
				'PlayerBowledWicket',
				'Dismissals',
				'Innings'
			]
		]);
		$this->set('wicket', $wicket);
	}

/**
 * Add method
 *
 * @return void
 */
	public function add() {
		$wicket = $this->Wickets->newEntity($this->request->data);
		if ($this->request->is('post')) {
			if ($this->Wickets->save($wicket)) {
				$this->Flash->success('The wicket has been saved.');
				return $this->redirect(['action' => 'index']);
			} else {
				$this->Flash->error('The wicket could not be saved. Please, try again.');
			}
		}
		$players = $this->Wickets->Players->find('PlayerListByTeam');
		$dismissals = $this->Wickets->Dismissals->find('list');
		$innings = $this->Wickets->Innings->find('list');
		$this->set(compact('wicket', 'players', 'dismissals', 'innings'));
	}

/**
 * Edit method
 *
 * @param string $id
 * @return void
 * @throws \Cake\Network\Exception\NotFoundException
 */
	public function edit($id = null) {
		$wicket = $this->Wickets->get($id, [
			'contain' => []
		]);
		if ($this->request->is(['patch', 'post', 'put'])) {
			$wicket = $this->Wickets->patchEntity($wicket, $this->request->data);
			if ($this->Wickets->save($wicket)) {
				$this->Flash->success('The wicket has been saved.');
				return $this->redirect(['action' => 'index']);
			} else {
				$this->Flash->error('The wicket could not be saved. Please, try again.');
			}
		}
		$players = $this->Wickets->Players->find('PlayerListByTeam');
		$dismissals = $this->Wickets->Dismissals->find('list');
		$innings = $this->Wickets->Innings->find('list');
		$this->set(compact('wicket', 'players', 'dismissals', 'innings'));
	}

/**
 * Delete method
 *
 * @param string $id
 * @return void
 * @throws \Cake\Network\Exception\NotFoundException
 */
	public function delete($id = null) {
		$wicket = $this->Wickets->get($id);
		$this->request->allowMethod('post', 'delete');
		if ($this->Wickets->delete($wicket)) {
			$this->Flash->success('The wicket has been deleted.');
		} else {
			$this->Flash->error('The wicket could not be deleted. Please, try again.');
		}
		return $this->redirect(['action' => 'index']);
	}
}<commit_msg>Allowed deletion of previously saved wickets<commit_after><?php
namespace App\Controller\Admin;

use App\Controller\AppController;

/**
 * Wickets Controller
 *
 * @property App\Model\Table\WicketsTable $Wickets
 */
class WicketsController extends AppController {

/**
 * Index method
 *
 * @return void
 */
	public function index() {
		$this->paginate = [
			'contain' => [
				'PlayerLostWicket',
				'PlayerTookWicket',
				'PlayerBowledWicket',
				'Dismissals',
				'Innings'
			]
		];
		$this->set('wickets', $this->paginate($this->Wickets));
	}

/**
 * View method
 *
 * @param string $id
 * @return void
 * @throws \Cake\Network\Exception\NotFoundException
 */
	public function view($id = null) {
		$wicket = $this->Wickets->get($id, [
			'contain' => [
				'PlayerLostWicket',
				'PlayerTookWicket',
				'PlayerBowledWicket',
				'Dismissals',
				'Innings'
			]
		]);
		$this->set('wicket', $wicket);
	}

/**
 * Add method
 *
 * @return void
 */
	public function add() {
		$wicket = $this->Wickets->newEntity($this->request->data);
		if ($this->request->is('post')) {
			if ($this->Wickets->save($wicket)) {
				$this->Flash->success('The wicket has been saved.');
				return $this->redirect(['action' => 'index']);
			} else {
				$this->Flash->error('The wicket could not be saved. Please, try again.');
			}
		}
		$players = $this->Wickets->Players->find('PlayerListByTeam');
		$dismissals = $this->Wickets->Dismissals->find('list');
		$innings = $this->Wickets->Innings->find('list');
		$this->set(compact('wicket', 'players', 'dismissals', 'innings'));
	}

/**
 * Edit method
 *
 * @param string $id
 * @return void
 * @throws \Cake\Network\Exception\NotFoundException
 */
	public function edit($id = null) {
		$wicket = $this->Wickets->get($id, [
			'contain' => []
		]);
		if ($this->request->is(['patch', 'post', 'put'])) {
			$wicket = $this->Wickets->patchEntity($wicket, $this->request->data);
			if ($this->Wickets->save($wicket)) {
				$this->Flash->success('The wicket has been saved.');
				return $this->redirect(['action' => 'index']);
			} else {
				$this->Flash->error('The wicket could not be saved. Please, try again.');
			}
		}
		$players = $this->Wickets->Players->find('PlayerListByTeam');
		$dismissals = $this->Wickets->Dismissals->find('list');
		$innings = $this->Wickets->Innings->find('list');
		$this->set(compact('wicket', 'players', 'dismissals', 'innings'));
	}

/**
 * Delete method
 *
 * @param string $id
 * @return void
 * @throws \Cake\Network\Exception\NotFoundException
 */
	public function delete($id = null) {
		$wicket = $this->Wickets->get($id);
		if ($this->Wickets->delete($wicket)) {
			$this->Flash->success('The wicket has been deleted.');
		} else {
			$this->Flash->error('The wicket could not be deleted. Please, try again.');
		}
		return $this->redirect($this->referer());
	}
}
{'fraction_non_alphanumeric': 0.20724663049186068, 'fraction_numerical': 0.0, 'mean_word_length': 3.8300929839391378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 145, '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': '2546885', 'n_tokens_mistral': 2173, 'n_tokens_neox': 1945, 'n_words': 370}