When you pass it in like that, your template variables should be loaded in the top-level. You'd expect to see a dump into your template


Try putting $Me.Debug into the template to see if it's getting passed in


The array passed contains not values containing the work 'data' either


@null, I've just changed the variable and template name in this. Nothing contains the word data except for $arrayData


Show 1 attachment(s)

Affected Version

framework 4.1.0 / PHP7.0


Creatiing a simple DataObject with a single Text field and naming it "Data" will cause problems when Calling $this->obj('Data') in any context. In my case, I am using the restfulserver package which attempts to decompose a DataObject into JSON via JSONDataFormatter which makes use of ViewableData::obj() when casting.

This occurs becuase of the core method DataObject::data() which is "blindly" called by ViewableData::obj() instead of the desired DBField by SilverStripe\Core\CustomMethods::hasMethod().

The problem can be demo'd fairly succinclty below:

Steps to Reproduce

class Page extends SiteTree
    private static $db = [
         'Data' => 'Text''

    public function getCMSFields()
        var_dump($this->obj('Data')); // prints `SiteTree` not `DBText`


The workaround is to declare a method on your datamodel named for the field and call getField('Data') from it, thus inverting otherwise default control.


"Data" is used in a DataObject context as DataObject::data() and is therefore a reserved word. As such, userland logic could receive an Exception on dev/build when attempting to declare a field-name that is reserved. The reserved field-names could be declared as an immutible array in DataObject to permit further fields to be added by core-devs in a flexible manner going forward.

Related PRs|#8731

Hide attachment content

^^ there was a framework bug raised recently where you can't use the word "Data" as a field name


This is what's in place to pass data to the template: (edit: changed data to myData. Note variable and template names not actual names used in effected code)

  1. $arrayData = new ArrayData(array(
  2. 'myData' => $myData,
  3. ));
  4. $html = $arrayData->renderWith('template');

It needs to be an ArrayList/ArrayData raw arrays don't work well in templates


Hey team, I'm struggling to get information displaying after passing it via renderWith to a Template file. The variable (a multi-dimensional array) passed to the template is accessible but I can't seem to get anything inside it.


Show 1 attachment(s)  
2019 Community Survey—Have your say

It’s time to have your say again! We’re running our (slightly delayed) annual community survey. This is your chance to tell us about you, how you’re using SilverStripe, and if we’re going in the right direction.

Hide attachment content
Patrick Nelson

I'm not sure if I see the logo, a galaxy, or a blue snake. either way, you don't wanna step on it.