Throw in a debug($this->request->data) to see what data you have. Though it's likely: $this->request->data['Item']['category_id'] or $this->request->data('Item.category_id')
On Fri, Oct 4, 2013 at 6:14 AM, Paul Willis <paul.wil...@me.com> wrote: > In my ItemsController I'm editing an item and then want to redirect back > to the category that the item is in but I'm not sure how to access the > category_id that is in $this->request->data > > My controller function (edited down to the relevant lines only) is... > > > public function admin_edit($id = null) { > if ($this->request->is('post') || > $this->request->is('put')) { > if ($this-> Item->save($this->request->data)) { > $this->Session->setFlash(__('The Item has > been saved')); > $this->redirect(array('controller' => > 'categories', 'action' => 'view', *********)); > } > } > } > > > Where I have ******* I need something likeā¦ > > $this->request-> Item->category_id > > ...to pull the category_id out but I can't get the correct syntax to use > > The category_id is in there as it is being saved with all the other item > data. > > I'm on CakePHP 2.3.x if that is relevant. > > Regards > > Paul > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/groups/opt_out. > -- Simon Males -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.