Created
May 7, 2014 12:26
-
-
Save anonymous/bc7c549311fad96c92dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
class Minhamodel extends AppModel{ | |
//Primeira opção, caso nunca mude o "alias" da model | |
public $virtualFields = array( | |
'data_formatada'=>"DATE_FORMAT(Minhamodel.data,'%d/%m/%Y')", | |
); | |
//Alternativa caso mude o "alias" da model, melhor opção | |
public function __construct($id=false,$table=null,$ds=null){ | |
parent::__construct($id,$table,$ds); | |
$this->virtualFields['data_formatada'] = "DATE_FORMAT({$this->alias}.data,''%d/%m/%Y)"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment