Files
budget/src/Controller/WlDstTypController.php
2018-04-02 08:23:14 +02:00

108 lines
3.2 KiB
PHP

<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* WlDstTyp Controller
*
* @property \App\Model\Table\WlDstTypTable $WlDstTyp
*
* @method \App\Model\Entity\WlDstTyp[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class WlDstTypController extends AppController
{
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$wlDstTyp = $this->paginate($this->WlDstTyp);
$this->set(compact('wlDstTyp'));
}
/**
* View method
*
* @param string|null $id Wl Dst Typ id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$wlDstTyp = $this->WlDstTyp->get($id, [
'contain' => []
]);
$this->set('wlDstTyp', $wlDstTyp);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$wlDstTyp = $this->WlDstTyp->newEntity();
if ($this->request->is('post')) {
$wlDstTyp = $this->WlDstTyp->patchEntity($wlDstTyp, $this->request->getData());
if ($this->WlDstTyp->save($wlDstTyp)) {
$this->Flash->success(__('The wl dst typ has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl dst typ could not be saved. Please, try again.'));
}
$this->set(compact('wlDstTyp'));
}
/**
* Edit method
*
* @param string|null $id Wl Dst Typ id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$wlDstTyp = $this->WlDstTyp->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$wlDstTyp = $this->WlDstTyp->patchEntity($wlDstTyp, $this->request->getData());
if ($this->WlDstTyp->save($wlDstTyp)) {
$this->Flash->success(__('The wl dst typ has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The wl dst typ could not be saved. Please, try again.'));
}
$this->set(compact('wlDstTyp'));
}
/**
* Delete method
*
* @param string|null $id Wl Dst Typ id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$wlDstTyp = $this->WlDstTyp->get($id);
if ($this->WlDstTyp->delete($wlDstTyp)) {
$this->Flash->success(__('The wl dst typ has been deleted.'));
} else {
$this->Flash->error(__('The wl dst typ could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}