0
I created a virtual field, but I don’t have much concept about it, until today I only used to make pagination, as I do to use the result of this virtual in a variable?
public $virtualFields = array(
'js_dt_inicio' => '(CASE WHEN inicio_de IS NOT NULL AND inicio_de!=\'\' AND DATE_ADD(CURDATE(), INTERVAL 30 DAY)<=inicio_de THEN inicio_de ELSE DATE_ADD(CURDATE(), INTERVAL 30 DAY) END)',
);
you know what a
virtualField
?– Erlon Charles
Create a virtual field with sql criteria in a template.
– Michel Henriq
Therefore this virtual field will be created on the return of a query
sql
, to return the virtual field value in a variable you need to make a query that returns yourvirtualField
.– Erlon Charles
My question is how to mount this query in the controller..
$this->Curso->find('js_dt_inicio')
;– Michel Henriq
$this->ModelName->find("all");
need to tell more details to help you assemble thisfind()
, what you’ve already done?– Erlon Charles