bfojcapell: Fixed php notice

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42150 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 17:02:17 +00:00
parent 3d7e381341
commit 9d32d9518f

View File

@ -372,12 +372,14 @@ HTML;
$i++; $i++;
} }
} else { } else {
list ($field, $caster) = explode("->", $field); $fieldParts = explode("->", $field);
$field = $fieldParts[0];
if(preg_match('/^(.+)\.(.+)$/', $field, $matches)) { if(preg_match('/^(.+)\.(.+)$/', $field, $matches)) {
$field = $matches[2]; $field = $matches[2];
} }
if($caster) { if(isset($fieldParts[1])) {
$caster = $fieldParts[1];
// When the intending value is Created.Date, the obj need to be casted as Datetime explicitely. // When the intending value is Created.Date, the obj need to be casted as Datetime explicitely.
if ($field == "Created" || $field == "LastEdited") { if ($field == "Created" || $field == "LastEdited") {
$created = Object::create('Datetime', $result->Created, "Created"); $created = Object::create('Datetime', $result->Created, "Created");