Friday, November 15, 2013

Re: What code to put for using the CakeDC search plugin?

Yes, I followed the readme.

I've added the plugin, the behavior and component. I am stuck on the filterArgs properties.

Here's my model code:

App::uses('Security', 'Utility');
App::uses('SearchableBehavior', 'Search.Model/Behavior');
App::uses('AppModel', 'Model');

class Venue extends AppModel {

  public $name = 'Venue';
  public $actAs = array(
                        'Containable',
                        'Search.Searchable');

  public $filterArgs = array(
    'name' => array('type' => 'like')
  );

//Controller code:

public function find(){
    $this->Prg->commonProcess();
    $this->Paginator->settings['conditions'] = $this->Venue->parseCriteria($this->Prg->parsedParams());
    $this->set('venues', $this->Paginator->paginate());
  }

//View code
echo $this->Form->create('Venue', array(
    'url' => array_merge(array('action' => 'find'), $this->params['pass'])
  ));
  echo $this->Form->input('name', array('div' => false));
  echo $this->Form->submit(__('Search'), array('div' => false));
  echo $this->Form->end();

Error recieved:
Notice (8): Array to string conversion [CORE\Cake\Model\Datasource\DboSource.php, line 460]
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'parseCriteria' at line 1

SQL Query: parseCriteria

Onn Friday, November 15, 2013 6:36:31 AM UTC-5, euromark wrote:
Did you follow the readme?
You need to be more specific when you ask a question - ideally including what you already tried so far.

Am Freitag, 15. November 2013 05:32:13 UTC+1 schrieb Charles Blackwell:
Do you need a create a search function of some sort to get it to work? I am stuck on how to get it working.

On Tuesday, December 13, 2011 6:51:30 PM UTC-5, Daniel wrote:
OK, forget it, I got a basic search up and running now.

--
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/groups/opt_out.

No comments: