Remove id property from bake template

This commit is contained in:
bancer 2018-10-31 09:46:01 +01:00
parent d8d65027ac
commit 58ebf6a303
3 changed files with 3 additions and 6 deletions

View file

@ -131,12 +131,11 @@
* @return void * @return void
*/ */
public function <?php echo $admin; ?>delete($id = null) { public function <?php echo $admin; ?>delete($id = null) {
$this-><?php echo $currentModelName; ?>->id = $id;
if (!$this-><?php echo $currentModelName; ?>->exists($id)) { if (!$this-><?php echo $currentModelName; ?>->exists($id)) {
throw new NotFoundException(__('Invalid <?php echo strtolower($singularHumanName); ?>')); throw new NotFoundException(__('Invalid <?php echo strtolower($singularHumanName); ?>'));
} }
$this->request->allowMethod('post', 'delete'); $this->request->allowMethod('post', 'delete');
if ($this-><?php echo $currentModelName; ?>->delete()) { if ($this-><?php echo $currentModelName; ?>->delete($id)) {
<?php if ($wannaUseSession): ?> <?php if ($wannaUseSession): ?>
$this->Flash->success(__('The <?php echo strtolower($singularHumanName); ?> has been deleted.')); $this->Flash->success(__('The <?php echo strtolower($singularHumanName); ?> has been deleted.'));
} else { } else {

View file

@ -77,12 +77,11 @@
* @return void * @return void
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->BakeArticle->id = $id;
if (!$this->BakeArticle->exists($id)) { if (!$this->BakeArticle->exists($id)) {
throw new NotFoundException(__('Invalid bake article')); throw new NotFoundException(__('Invalid bake article'));
} }
$this->request->allowMethod('post', 'delete'); $this->request->allowMethod('post', 'delete');
if ($this->BakeArticle->delete()) { if ($this->BakeArticle->delete($id)) {
$this->Flash->success(__('The bake article has been deleted.')); $this->Flash->success(__('The bake article has been deleted.'));
} else { } else {
$this->Flash->error(__('The bake article could not be deleted. Please, try again.')); $this->Flash->error(__('The bake article could not be deleted. Please, try again.'));

View file

@ -71,12 +71,11 @@
* @return void * @return void
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->BakeArticle->id = $id;
if (!$this->BakeArticle->exists($id)) { if (!$this->BakeArticle->exists($id)) {
throw new NotFoundException(__('Invalid bake article')); throw new NotFoundException(__('Invalid bake article'));
} }
$this->request->allowMethod('post', 'delete'); $this->request->allowMethod('post', 'delete');
if ($this->BakeArticle->delete()) { if ($this->BakeArticle->delete($id)) {
return $this->flash(__('The bake article has been deleted.'), array('action' => 'index')); return $this->flash(__('The bake article has been deleted.'), array('action' => 'index'));
} else { } else {
return $this->flash(__('The bake article could not be deleted. Please, try again.'), array('action' => 'index')); return $this->flash(__('The bake article could not be deleted. Please, try again.'), array('action' => 'index'));