Skip to content

Commit

Permalink
Fixing baked actions to use request object.
Browse files Browse the repository at this point in the history
Fixes #1091
  • Loading branch information
markstory committed Nov 7, 2010
1 parent 1c37751 commit af303f0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cake/console/templates/default/actions/controller_actions.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@

<?php $compact = array(); ?>
public function <?php echo $admin ?>add() {
if (!empty($this->data)) {
if ($this->request->is('post')) {
$this-><?php echo $currentModelName; ?>->create();
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
<?php if ($wannaUseSession): ?>
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
$this->redirect(array('action' => 'index'));
Expand Down Expand Up @@ -72,16 +72,16 @@

<?php $compact = array(); ?>
public function <?php echo $admin; ?>edit($id = null) {
if (!$id && empty($this->data)) {
if (!$id && empty($this->request->data)) {
<?php if ($wannaUseSession): ?>
$this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action' => 'index'));
<?php else: ?>
$this->flash(sprintf(__('Invalid <?php echo strtolower($singularHumanName); ?>')), array('action' => 'index'));
<?php endif; ?>
}
if (!empty($this->data)) {
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
if ($this->request->is('post')) {
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
<?php if ($wannaUseSession): ?>
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
$this->redirect(array('action' => 'index'));
Expand All @@ -94,7 +94,7 @@
<?php endif; ?>
}
}
if (empty($this->data)) {
if (!$this->request->is('post')) {
$this->data = $this-><?php echo $currentModelName; ?>->read(null, $id);
}
<?php
Expand Down

0 comments on commit af303f0

Please sign in to comment.