src/Controller/AbstractTermsController.php
public function add()
    {
        $term = $this->Terms->newEntity();
        if ($this->request->is('post')) {
            $term = $this->Terms->patchEntity($term, $this->request->data);
            if ($this->Terms->save($term)) {
                $this->Flash->success(__('The term has been saved.'));

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

                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error(__('The term could not be saved. Please, try again.'));
            }
        }
        $vocabularies = $this->Terms->Vocabularies->find('list', ['limit' => 200]);
        $this->set(compact('term', 'vocabularies'));
        $this->set('_serialize', ['term']);
    }
Add method

@return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.