Closed NickStallman closed 4 years ago
This should be possible, can you provide an example that is not working as expected?
I've tried the following:
$h->table('cars')
->select([new Func('myCoolFunc', 'a', new Expression('15'))])
->execute();
Which resulted in the expected query:
select myCoolFunc(`a`, 15) from `cars`
Closing, let me know if the issue persists.
I didn't find any example of how to use arbitrary MySQL functions, it looks like only the provided ones like AVG, MIN and MAX can be used.
I tested sending a Func() object as the right hand side of a where clause and it failed due to param() in the translator checking for expressions but not functions.
It should also be possible to put a function as a SELECT parameter as well. This is useful for converting a datetime to a date for example when querying.
It's possible I missed the method and there just isn't an example highlighting this usage. I did search the code however and only found Func() referenced in the aggregate functions.