i'm trying to develop a simple search form using cakedc plugin, i followed step by step the instructions , but i got the next error:
Database Error
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 'validateSearch' at line 1
SQL Query: validateSearch
i don't know what i got wrong, can you help me?, this is what i've got, Thank you. In the Controller:
class ProductosController extends AppController {
public $name = 'Productos';
public $uses = array('Empleado','Cliente', 'Mesa','Producto', 'Productotipo','Productos');
public $components = array('Search.Prg');
public $presetVars = true;
public $paginate=array();
public function ventas(){
$this->Prg->commonProcess();
$this->paginate['conditions'] = $this->Producto->parseCriteria($this->Prg->parsedParams());
$this->set('productos', $this->paginate());
}
In the Model:
class Producto extends AppModel {
public $name = 'Producto';
public $displayField = 'productotipos_id';
public $belongsTo = array('Productotipo'=>array('className'=>'Productotipo','foreignKey'=>'productotipos_id','conditions'=>'','order'=>''));
public $actsAs = array('Search.Searchable');
public $filterArgs = array(
'nombre' => array('type' => 'like')
);
In the view
<?php echo $this->Form->create('Producto', array('url' => array_merge(array('action'=>'ventas'), $this->params['pass'])));?>
<fieldset>
<legend>Pedido</legend>
<?php
echo $this->Form->input('Producto.nombre', array('div'=>false, 'empty'=>true));
echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();
?>
</fieldset>
Try to reorder $uses
that Controller's model will be the first:
public $uses = array('Producto', 'Empleado', 'Cliente', 'Mesa', 'Productotipo');
Should help. Don't know why, but probably some of methods from CakeDC Search plugin depends on first item in this array.