21294 Posts in 5734 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 317 Views |
-
custom getter in Page class?

1 November 2011 at 10:19am
Does anyone know why, in the Page class using a custom getter like the following will get me a [notice]: undefined property: Page::$MyField):
static $db = array ('MyField' => 'Varchar(255)');
function getMyField() {
return $this->MyField;
}While I can do so on existing SiteTree::$db fields without any problem?
function getContent() {
return $this->Content;
}Must be something stupid I'm missing?
-
Re: custom getter in Page class?

1 November 2011 at 9:07pm
Well for one, you shouldn't do that, as $this->Content will call getContent() before your db field. If you want the object then use $this->dbObject('MyField');
-
Re: custom getter in Page class?

2 November 2011 at 12:39am
Thanks willr! OK, so I'm glad I didn't really use it anywhere, just tried it out in search of some solution and suddenly got mighty confused
Martine
| 317 Views | ||
|
Page:
1
|
Go to Top |

