I am trying to add a custom function converter to be able to use the mySQL function DATE_ADD. How do I pass the string INTERVAL 1 YEAR as a parameter?
This results in $argumentList coming into this function as:
$argumentList= [["created_date","i_n_t_e_r_v_a_l1_y_e_a_r"]] but I want $argumentList= [["created_date","INTERVAL 1 YEAR"]] ?
PHP Code:
use Espo\ORM\QueryComposer\Part\FunctionConverter;
class DateAdd implements FunctionConverter
{
public function convert(string ...$argumentList): string
{
return 'DATE_ADD(' . implode(', ', $argumentList) . ')';
}
}
PHP Code:
$query = (new SelectBuilder())
->select([
['DATE_ADD:(createdDate,INTERVAL 1 YEAR)','someDate']
]);
$argumentList= [["created_date","i_n_t_e_r_v_a_l1_y_e_a_r"]] but I want $argumentList= [["created_date","INTERVAL 1 YEAR"]] ?
Comment