Wednesday, September 2, 2015

how to debug on a "add" function of controller

hello,

i've inserted a debug($this->request->data) into the add function of my controller but nothing is rendered when i've add some data
code looks like:

    public function add()
    {
        $magazine = $this->Magazines->newEntity();
        if ($this->request->is('post')) {
            debug($this->request->data);
            $magazine = $this->Magazines->patchEntity($magazine, $this->request->data);
            if ($this->Magazines->save($magazine)) {
                $this->Flash->success(__('The magazine has been saved.'));
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error(__('The magazine could not be saved. Please, try again.'));
            }
        }
        $periodicity = $this->Magazines->Periodicity->find('list', ['limit' => 200]);
        $categories = $this->Magazines->Categories->find('list', ['limit' => 200]);
        $this->set(compact('magazine', 'periodicity', 'categories'));
        $this->set('_serialize', ['magazine']);
    }

what i'm doing wrong?

thanks in advance  

--
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+unsubscribe@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/d/optout.

No comments: