title: Storing key value dictionary in Elgg
body: <p>I am working on a plugin for Elgg that keeps track of device ids that are sent to the application when logging in from your mobile phone. For this, I would like to store these device ids in the database and would like to use ElggObjects for this.</p>
  
  <p>This is what I do now:</p>
  
  <pre><code>function initialize() {
       $androidTokens = elgg_get_entities(array(
            'type' =&gt; 'object',
            'subtype' =&gt; 'androidTokens',
            'limit' =&gt; 0
       ));
       $iosTokens = elgg_get_entities(array(
            'type' =&gt; 'object',
            'subtype' =&gt; 'iosTokens',
            'limit' =&gt; 0
       ));
  
       if ($androidTokens == 0) {
            $tokenObject = new ElggObject();
            $tokenObject-&gt;subtype = 'androidTokens';
            $tokenObject-&gt;tags = array();
            $tokenObject-&gt;save();
       }
  
       if ($iosTokens == 0) {
            $tokenObject = new ElggObject();
            $tokenObject-&gt;subtype = 'iosTokens';
            $tokenObject-&gt;tags = array();
            $tokenObject-&gt;save();
       }
  }
  </code></pre>
  
  <p>So this generates two ElggObjects that hold ids for android and for ios devices, stored in the metadata field tags. This array of tags can however not be retrieved anymore. When I do:</p>
  
  <pre><code>$tokenObject = elgg_get_entities(array(
                           'type' =&gt; 'object',
                           'subtype' =&gt; $os.'Tokens',
                           'limit' =&gt; 0
                      ));
                 $tokens = $tokenObject-&gt;tags
  </code></pre>
  
  <p>tokens remains empty. Does someone know what I am doing wrong? Am I using the Elgg objects wrong?</p>