| 1 | <?php |
||
| 8 | class PaymentMessage extends DataObject{ |
||
| 9 | |||
| 10 | private static $db = array( |
||
| 11 | //Created |
||
| 12 | "Message" => "Varchar(255)", |
||
| 13 | "ClientIp" => "Varchar(39)" |
||
| 14 | ); |
||
| 15 | |||
| 16 | private static $has_one = array( |
||
| 17 | "Payment" => "Payment", |
||
| 18 | "User" => "Member" //currently logged in user, if appliciable |
||
| 19 | ); |
||
| 20 | |||
| 21 | private static $summary_fields = array( |
||
| 22 | 'i18n_singular_name' => "Type", |
||
| 23 | 'Message' => "Message", |
||
| 24 | 'User.Name' => "User" |
||
| 25 | ); |
||
| 26 | |||
| 27 | public function getCMSFields() { |
||
| 30 | |||
| 31 | public function onBeforeWrite() { |
||
| 32 | parent::onBeforeWrite(); |
||
| 33 | //automatically set the current user id for new payment messages |
||
| 34 | if (!$this->UserID && !$this->isInDB()) { |
||
|
|
|||
| 35 | $this->UserID = Member::currentUserID(); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | function getTitle(){ |
||
| 42 | |||
| 43 | } |
||
| 44 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.