Closed flashios09 closed 8 years ago
You should probably make a custom condition then as documented.
hi I want use connector '+' for AND ',' for OR but its not working in my code: public $hasAndBelongsToMany = array( 'Competence' => array( 'with' => 'CompetencesUser', 'className' => 'Competence', 'joinTable' => 'competences_users', 'foreignKey' => 'user_id', 'associationForeignKey' => 'competence_id', 'unique' => 'keepExisting', ) );
public $filterArgs = array( 'username' => array( 'type' => 'value' ), 'nom' => array( 'type' => 'like' ), 'prenom' => array( 'type' => 'like' ), 'email' => array( 'type' => 'value' ), 'competences' => array( 'type' => 'subquery', 'method' => 'findByCompetences', 'field' => 'User.id', 'before' => true ),
'search_with_connectors' => array(
'type' => 'like',
'field' => 'Competence.competence',
'connectorAnd' => '+', 'connectorOr' => ','
) ); public function findByCompetences($data = array()) {
$this->CompetencesUser->Behaviors->attach('Containable', array(
'autoFields' => false
)
);
$this->CompetencesUser->Behaviors->attach('Search.Searchable');
$query = $this->CompetencesUser->getQuery('all', array(
'conditions' =>
array(
'Competence.competence' => $data['competences'],
),
'fields' => array(
'user_id'
),
'contain' => array(
'Competence'
)
));
return $query;
}
Guess we can close this and focus on #204
Hi, Closing this issue, please open a new one if still needed.
Hi, Thanks @deizel (and all the CakeDC team) for this awesome cakephp plugin :+1: Sorry for my bad english Let's say that i have two actions in my controller, the first is filter and the second is enhancedSearch. I have two field in my table min and max. That's my Search plugin config:
By default this config will generate an
AND
condition(exp.... WHERE min=5 AND max=10
), i need anAND
condition in the filter action but i need anOR
condition(exp.... WHERE min=5 OR max=10
) in the enhancedSearch action. What i have to do ?Thanks