1
I have a field nome_email
, where the user enters any string and I need to be filtered everything that is placed in this field and display something corresponding to the NOME
or EMAIL
of the registered customer.
Any idea how to do this?
In accordance with Pedro Elsner:
<?php
$this->FilterResults->addFilters(
array(
'OR' => array(
'filter1' => array(
'User.name' => array('operator' => 'LIKE'),
'User.active' => array('value' => '1')
)
'filter2' => array(
'User.username' => array('operator' => 'LIKE')
)
)
)
);
"Let’s change our example to concatenate the filters by the OR rule, and if filter1 is informed we want only active users. From this we get the condition:"
WHERE ((User.name LIKE '%Pedro%')
AND (User.active = 1))
OR (User.username LIKE '%elsner%')
So what I need is a Filtro
whose condition returned would be something like:
WHERE ((User.name ILIKE '%Pedro%') OR (User.username ILIKE '%Pedro%'))
Wouldn’t it be better if you left 2 separate fields?
– Jeferson Assis
Maybe, but I need to do it like this.
– Marcos Henzel