public function search($vocabularyId)
    {
        $this->loadModel('Taxonomy.Terms');
        $out = [];
        $text = $this->request->query['q'];
        $terms = $this->Terms
            ->find()
            ->select(['id', 'name'])
            ->where(['name LIKE' => "%%{$text}%%", 'vocabulary_id' => $vocabularyId])
            ->limit(10)
            ->all();

        foreach ($terms as $term) {
            $out[] = ['id' => $term->id, 'name' => $term->name];
        }

        die(json_encode($out));
    }
public function search($vocabularyId)
    {
        $this->loadModel('Taxonomy.Terms');
        $out = [];
        $text = $this->request->query['q'];
        $terms = $this->Terms
            ->find()
            ->select(['id', 'name'])
            ->where(['name LIKE' => "%%{$text}%%", 'vocabulary_id' => $vocabularyId])
            ->limit(10)
            ->all();

        foreach ($terms as $term) {
            $out[] = ['id' => $term->id, 'name' => $term->name];
        }

        die(json_encode($out));
    }
public function search ( $ vocabularyId ) { $ this -> loadModel ( 'Taxonomy.Terms' ) ; $ out = [ ] ; $ text = $ this -> request -> query [ 'q' ] ; $ terms = $ this -> Terms -> find ( ) -> select ( [ 'id' , 'name' ] ) -> where ( [ 'name LIKE' => "%%{$text}%%" , 'vocabulary_id' => $ vocabularyId ] ) -> limit ( 10 ) -> all ( ) ; foreach ( $ terms as $ term ) { $ out [ ] = [ 'id' => $ term -> id , 'name' => $ term -> name ] ; } die ( json_encode ( $ out ) ) ; }
Shows a list of matching terms.

@param int $vocabularyId Vocabulary's ID for which render its terms
@return void
Shows a list of matching terms .