Thanks, This way also doesn't work. But why? I tested it in some ways. I dont't know why the reject Action works only with the status field.
i should post my sourcecode here of this action. The commented area is the code which allows to set the status free. The problem is, that this code only works if the 3 lines are commented. If i use this 3 lines the reject Action doesn't reject. The action don't work. something isn't well. Thanks for your help To explain. The user can add an e-mail and a code to activate an account, he gets an e-mail with an activation link, with the uuid. If he had activated he can use an other link the reject(give back) his activation, The link for an activation is so. http://localhost/mahaloo/wishlist_entries/confirm/12/token:a8caff15-41f2-4b28-9577-f5f688378806 and the link for a reject http://localhost/mahaloo/wishlist_entries/reject/12/token:a8caff15-41f2-4b28-9577-f5f688378806 Thanks a lot marcus function reject($entryId = null) { // check valid entryId if(!$entryId) { $this->Session->setFlash('Falsche URL.', 'default', array('class' => 'message_error')); $this->redirect(array('controller' => 'wishlists', 'action' => 'present')); } // check Token was submitted if(empty($this->params['named']['token'])) { $this->Session->setFlash('Falsche URL.'); $this->redirect(array('controller' => 'wishlists', 'action' => 'view', $entryId)); } // get the data $reservation_token = $this->params['named']['token']; $entry = $this->WishlistEntry->read(null, $entryId); if($entry && $reservation_token) { // valid entry && token was submitted // only reserved entries can be rejected if(strcasecmp('RESERVED', $entry['WishlistEntry'] ['reservation_status']) != 0) { $this->Session->setFlash('Der Eintrag muss erst reserviert werden, bevor die Reservierung aufgelöst werden kann.'); $this->redirect(array('controller' => 'wishlists', 'action' => 'view', $entry['WishlistEntry']['wishlist_id'])); } // check the token if( strcasecmp($entry['WishlistEntry'] ['reservation_token'], $reservation_token) == 0 ) { // remove the registration. $this->set('status', 'success'); $this->set('entry', $entry); // send reject mail $this->__sendRejectMail($entry); // save the stuff // $this->WishlistEntry->read(null, $entryId); // $this->WishlistEntry->save( // array( // 'reservation_status' => 'FREE' // // ,'reservation_email' => null // // ,'reservation_mail_sent' => null // // ,'reservation_token' => String::uuid() // ) // ); $this->WishlistEntry->read(null, $entryId); $this->WishlistEntry->set(array( 'reservation_status' , 'FREE', 'reservation_email' , NULL, 'reservation_mail_sent', 'NULL', 'reservation_token' , String::uuid() )); $this->WishlistEntry->save(); $this->Session->setFlash( 'Deine Reservierung für '. $entry['WishlistEntry']['title']. ' wurde <strong>erfolgreich</strong> aufgehoben', 'default', array('class' => 'message_info') ); $this->redirect(array('controller' => 'wishlists', 'action' => 'view', $entry['WishlistEntry']['wishlist_id'])); } else { // show the entry $this->Session->setFlash('Falscher Token. Die Reservierung für das Geschenk '.$entry['WishlistEntry'] ['title'].' kann nicht gelöscht werden'); $this->redirect(array('controller' => 'wishlists', 'action' => 'view', $entry['WishlistEntry']['wishlist_id'])); } } else { $this->Session->setFlash('Falsche URL.', 'default', array('class' => 'message_error')); $this->redirect(array('controller' => 'wishlists', 'action' => 'select')); } } On 21 Feb., 11:18, WebbedIT <[email protected]> wrote: > OK, apologies for redirecting you to the cookbook when your initial > entry had followed the structure explained on the Saving Your Data > page, it's just I have never used the Model->set method to save things > so it looked odd to me. > > You have taken > > 1. $this->Post->read(null, 1); > 2. $this->Post->set(array( > 3. 'title' => 'New title', > 4. 'published' => false > 5. )); > 6. $this->Post->save(); > > and made it into > > 1. $this->WishlistEntry->read(null, $entryId); > 2. $this->WishlistEntry->set( > 3. 'reservation_status' , 'FREE', > 4. 'reservation_email' , 'NULL', > 5. 'reservation_mail_sent', 'NULL', > 6. 'reservation_token' , String::uuid() > 7. ); > 8. $this->WishlistEntry->save(); > > If you compare the two you should be able to spot the issue as you've > not supplied your fields as an array. Try > > 1. $this->WishlistEntry->read(null, $entryId); > 2. $this->WishlistEntry->set(array( > 3. 'reservation_status' , 'FREE', > 4. 'reservation_email' , 'NULL', > 5. 'reservation_mail_sent', 'NULL', > 6. 'reservation_token' , String::uuid() > 7. )); > 8. $this->WishlistEntry->save(); > > HTH > > Paul. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
