Join with 'LIKE' operator and 'OR' operator in where query
Join with 'LIKE' operator and 'OR' operator in where query
1. I would like to know if there is a posibility to use the 'LIKE' operator in a join instance:
[code]
->join(Join::inst('keywords', 'object')
->join('string1', 'string2')
[/code]
if I have string1 'something' and string2 'something more', can I join the parent and child table using the mysql LIKE operator?
2. Use 'OR' operator in where query
from docs: [quote] Where query - multiple conditions are bound as ANDs. [/quote]
If I have this case:
[code]
$out = $editor
->where('id_kw', '1', '=')
->where('id_url', '1', '=')
[/code]
can this be translated in a similar mysql query 'WHERE id_kw = 1 OR id_url = 1' or it's possible only using the 'AND' operator?
[code]
->join(Join::inst('keywords', 'object')
->join('string1', 'string2')
[/code]
if I have string1 'something' and string2 'something more', can I join the parent and child table using the mysql LIKE operator?
2. Use 'OR' operator in where query
from docs: [quote] Where query - multiple conditions are bound as ANDs. [/quote]
If I have this case:
[code]
$out = $editor
->where('id_kw', '1', '=')
->where('id_url', '1', '=')
[/code]
can this be translated in a similar mysql query 'WHERE id_kw = 1 OR id_url = 1' or it's possible only using the 'AND' operator?
This discussion has been closed.
Replies
Regarding the second point, that also would require a code change. In Editor.php the function `_get_where` is what combines the where conditions. It would be possible to modify that to use `or_where()` etc. Again, I like the idea of exposing this, perhaps as a fourth parameter in the Editor `where()` method.
I hope this helps a bit, and thanks for the feedback!
Allan
I will look into changing the classes as you mentioned and I am glad that you are considering adding this options into a future release.
Great work!