<p>The reason the attribute for your Super Table is null is because the field is an element, which doesn't have 'simple' content. You'll find this is the exact same case for any other element like an Entries field, or a Matrix field.</p>

<p>I believe the reason for this is that this simply fetches the content from the actual <code>craft_content</code> table. Being complex (relational) data, there's technically nothing in the content table. Getting the content is a little more complex.</p>

<p>In the case of Super Table (and other elements), when querying the field's content on an attached element, you'll get an ElementCriteriaModel (for Craft 2) returned, which allows you to do all sorts of things when outputting the content of a Super Table (limit, order, etc).</p>

<p>To illustrate, you can do:</p>

<pre><code>var_dump($response[0]-&gt;lifeBeforeColumnOne);
</code></pre>

<p>Which will output the ElementCriteriaModel, which will be not overly useful for actual content output. In addition, you'll want to call <code>find()</code> on the criteria (just like you're doing above in your code to fetch the entries) to return an array of <code>SuperTable_BlockModel</code>'s.</p>

<pre><code>$blocks = $response[0]-&gt;lifeBeforeColumnOne-&gt;find();

foreach ($blocks as $block) {
    var_dump($block-&gt;featuredImage);
    var_dump($block-&gt;textContent);
    var_dump($block-&gt;source);
}
</code></pre>

<p>You can then output the content by targeting the inner fields'.</p>

<p>You might also find this slightly related conversation useful - <a href="https://craftcms.stackexchange.com/questions/4348/getting-all-content-including-matrix-fields-from-an-entrymodel/4552#4552">Getting all content, including Matrix fields from an EntryModel</a></p>

<p>There's also an example of this sort of functionality on the docs - <a href="https://verbb.io/craft-plugins/super-table/docs/guides/developer-examples#fetching-content-from-a-super-table-field" rel="nofollow noreferrer">https://verbb.io/craft-plugins/super-table/docs/guides/developer-examples#fetching-content-from-a-super-table-field</a></p>

CC BY-SA 3.0
2018-02-28T22:00:53.153Z
Thanks for the clear and concise reply. I'm glad I will be able to use the plugin for my project still. Basically this setup is going to grow to about four super table fields (column one, column two, column three, column four) with the exact same inner setup. Ill mark this as correct, as it answers my question about why its null. Cheers.
Dan Zuzevich
CC BY-SA 3.0
2018-02-28T21:26:32.860Z
2018-02-28T21:34:15.603Z
2018-02-28T21:34:15.603Z
crawf
<p>I am performing a query from within a plugin like so:</p>

<pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = $journeyTitle;
$response = $criteria-&gt;find();
$attributes = $response[0]-&gt;getContent()-&gt;getAttributes();
var_dump($attributes);
</code></pre>

<p>The dump gives me the following:</p>

<pre><code>array(7) {
  ["id"]=&gt;
  string(1) "3"
  ["elementId"]=&gt;
  string(1) "3"
  ["locale"]=&gt;
  string(5) "en_us"
  ["title"]=&gt;
  string(7) "Armenia"
  ["lifeBeforeColumnOne"]=&gt;
  NULL
  ["lifeBeforeColumnTwo"]=&gt;
  NULL
  ["tester"]=&gt;
  string(12) "fdsfsdfdsfsd"
}
</code></pre>

<p>Has anyone ever used Super Table Before, and know why this would be showing up null? I would REALLY like to use this on my project, but am not really sure on how to proceed with this.</p>

<p>For reference, here is a screenshot of the entry that you see outputted within the dump:
<a href="https://i.sstatic.net/qeIY7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qeIY7.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2018-02-28T16:52:46.910Z
Might be good to mention that this is for Craft 2.6.3004, not the Craft 3 version of the plugin.
Dan Zuzevich
CC BY-SA 3.0
2018-02-28T17:06:46.353Z
I noticed the same issue today with the Craft 3 Version and fixed that issue in the code. I'm not sure if this is worth an answer so I'll leave it as a comment. I noticed some really strange bugs in this plugin overall so I fixed them and now we use a custom version of this plugin for future projects. I suggest you to do the same or use an other plugin/create your own
Robin Schambach
CC BY-SA 3.0
2018-02-28T17:11:24.327Z
oh dear lord. Was it a quick fix for that to not show up null, or did it take some significant reworking? The project I am working on would greatly be improved workflow wise if I could get this to work. I don't mind looking at the code to try to fix it myself.
Dan Zuzevich
CC BY-SA 3.0
2018-02-28T20:43:33.407Z
@RobinSchambach I'd be interested to know what your issues where and if we should fix them for the greater community to benefit.
crawf
CC BY-SA 3.0
2018-03-01T07:17:02.107Z
@crawf I'm so sorry I messed it up. Unfortunately I thought this question was about supercool table but it's only about supertable. I wasn't talking about your plugin but from another that throws exceptions when you even try to save an entry.
Robin Schambach
<plugin-supertable>
SuperTable Field returning null
# SuperTable Field returning null

(Asked by: username_0 on 2018-02-28)

I am performing a query from within a plugin like so:
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section = $journeyTitle;
$response = $criteria->find();
$attributes = $response[0]->getContent()->getAttributes();
var_dump($attributes);

The dump gives me the following:
array(7) {
  ["id"]=>
  string(1) "3"
  ["elementId"]=>
  string(1) "3"
  ["locale"]=>
  string(5) "en_us"
  ["title"]=>
  string(7) "Armenia"
  ["lifeBeforeColumnOne"]=>
  NULL
  ["lifeBeforeColumnTwo"]=>
  NULL
  ["tester"]=>
  string(12) "fdsfsdfdsfsd"
}

Has anyone ever used Super Table Before, and know why this would be showing up null? I would REALLY like to use this on my project, but am not really sure on how to proceed with this.
For reference, here is a screenshot of the entry that you see outputted within the dump:

**Tags:** plugin-supertable
> **Comments:**
> **username_0**: Might be good to mention that this is for Craft 2.6.3004, not the Craft 3 version of the plugin.  
> **username_1**: I noticed the same issue today with the Craft 3 Version and fixed that issue in the code. I'm not sure if this is worth an answer so I'll leave it as a comment. I noticed some really strange bugs in this plugin overall so I fixed them and now we use a custom version of this plugin for future projects. I suggest you to do the same or use an other plugin/create your own  
> **username_0**: oh dear lord. Was it a quick fix for that to not show up null, or did it take some significant reworking? The project I am working on would greatly be improved workflow wise if I could get this to work. I don't mind looking at the code to try to fix it myself.  
> **username_2**: @RobinSchambach I'd be interested to know what your issues where and if we should fix them for the greater community to benefit.  
> **username_1**: @crawf I'm so sorry I messed it up. Unfortunately I thought this question was about supercool table but it's only about supertable. I wasn't talking about your plugin but from another that throws exceptions when you even try to save an entry.  

---

## 1 answers

### Answer by username_2 on 2018-02-28. Score: 2 | Accepted answer

The reason the attribute for your Super Table is null is because the field is an element, which doesn't have 'simple' content. You'll find this is the exact same case for any other element like an Entries field, or a Matrix field.
I believe the reason for this is that this simply fetches the content from the actual craft_content table. Being complex (relational) data, there's technically nothing in the content table. Getting the content is a little more complex.
In the case of Super Table (and other elements), when querying the field's content on an attached element, you'll get an ElementCriteriaModel (for Craft 2) returned, which allows you to do all sorts of things when outputting the content of a Super Table (limit, order, etc).
To illustrate, you can do:
var_dump($response[0]->lifeBeforeColumnOne);

Which will output the ElementCriteriaModel, which will be not overly useful for actual content output. In addition, you'll want to call find() on the criteria (just like you're doing above in your code to fetch the entries) to return an array of SuperTable_BlockModel's.
$blocks = $response[0]->lifeBeforeColumnOne->find();

foreach ($blocks as $block) {
    var_dump($block->featuredImage);
    var_dump($block->textContent);
    var_dump($block->source);
}

You can then output the content by targeting the inner fields'.
You might also find this slightly related conversation useful - Getting all content, including Matrix fields from an EntryModel
There's also an example of this sort of functionality on the docs - https://verbb.io/craft-plugins/super-table/docs/guides/developer-examples#fetching-content-from-a-super-table-field

> **Comments:**
> **username_0**: Thanks for the clear and concise reply. I'm glad I will be able to use the plugin for my project still. Basically this setup is going to grow to about four super table fields (column one, column two, column three, column four) with the exact same inner setup. Ill mark this as correct, as it answers my question about why its null. Cheers.  

---

