Using Virtualfields in cakephp variable

Asked

Viewed 43 times

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)',
);
  • 1

    you know what a virtualField?

  • Create a virtual field with sql criteria in a template.

  • 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 your virtualField.

  • My question is how to mount this query in the controller.. $this->Curso->find('js_dt_inicio');

  • $this->ModelName->find("all"); need to tell more details to help you assemble this find(), what you’ve already done?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.