Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
# /app/Model/Contact.php
class Contact extends AppModel {
public $displayField = 'fullname';
public $virtualFields = array(
'fullname' => 'CONCAT(Contact.name, " ", Contact.surname)',
'withCompany' => 'CONCAT(Contact.name, " ", Contact.surname, " - ", Contact.company',
'bySurname' => 'CONCAT(Contact.surname, " ", Contact.name)',
);
public function getUserInfos($id) {
$this->virtualFields['userInfos'] = 'CONCAT(Contact.name, " ", Contact.surname, " - iscritto il ", Contact.created';
return $this->findById($id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.