From 23321284608b70cc141c37067aa33243ed24721a Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 3 Mar 2010 02:59:34 +0000 Subject: [PATCH] ENHANCEMENT #5072 RSSFeed_Entry::rssField() now respects custom getters on the data class git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100400 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- api/RSSFeed.php | 8 +++++--- tests/api/RSSFeedTest.php | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/RSSFeed.php b/api/RSSFeed.php index 69e4558aa..30551eba9 100755 --- a/api/RSSFeed.php +++ b/api/RSSFeed.php @@ -276,8 +276,7 @@ class RSSFeed_Entry extends ViewableData { * @return string Returns the author of the entry. */ function Author() { - if($this->authorField) - return $this->failover->obj($this->authorField); + if($this->authorField) return $this->failover->obj($this->authorField); } /** @@ -287,7 +286,10 @@ class RSSFeed_Entry extends ViewableData { function rssField($fieldName, $defaultClass = 'Varchar') { if($fieldName) { if($this->failover->castingHelperPair($fieldName)) { - return $this->failover->obj($fieldName); + $value = $this->failover->$fieldName; + $obj = $this->failover->obj($fieldName); + $obj->setValue($value); + return $obj; } else { $obj = new $defaultClass($fieldName); $obj->setValue($this->failover->XML_val($fieldName)); diff --git a/tests/api/RSSFeedTest.php b/tests/api/RSSFeedTest.php index 73528aa88..e957fc444 100755 --- a/tests/api/RSSFeedTest.php +++ b/tests/api/RSSFeedTest.php @@ -59,13 +59,13 @@ class RSSFeedTest_ItemA extends ViewableData { 'AltContent' => 'Text', ); - function Title() { + function getTitle() { return "ItemA"; } - function Content() { + function getContent() { return "ItemA Content"; } - function AltContent() { + function getAltContent() { return "ItemA AltContent"; }