Skip to content

Instantly share code, notes, and snippets.

@DevJMD
Created November 30, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevJMD/4f12621f62d438eb2037 to your computer and use it in GitHub Desktop.
Save DevJMD/4f12621f62d438eb2037 to your computer and use it in GitHub Desktop.
<?php
class Person extends DataObject {
private static $has_one = array(
'Photo' => 'Image',
);
private static $db = array(
'FirstName' => 'Varchar(32)',
'LastName' => 'Varchar(32)',
'Email' => 'Varchar(250)'
);
private static $summary_fields = array(
'Photo.StripThumbnail' => '',
'FirstName' => 'FirstName',
'LastName' => 'LastName',
'Email' => 'Email'
);
private static $searchable_fields = array(
'FirstName',
'LastName'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
public function canCreate($member = NULL) { return TRUE; }
public function canEdit($member = NULL) { return TRUE; }
public function canDelete($member = NULL) { return TRUE; }
public function canView($member = NULL) { return TRUE; }
public function Name() {
return $this->FirstName . ' ' . $this->LastName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment