Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The related <code>outboundform</code> row's properties should be accessible in the result object prefixed with the relation's name. So the <code>id</code> becomes <code>outboundform_id</code>, the <code>reference_type</code> becomes <code>outboundform_reference_type</code> and so on.</p> <p>The problem is that <code>all_to_array()</code> doesn't transfer those to the array version of results. If you want to include them you will have to explicitly list them:</p> <pre><code>$arrAll = $p-&gt;/* snip */-&gt;all_to_array(array('id', 'name', 'outboundform_id', 'outboundform_reference_type')); // Project fields and outboundform fields too </code></pre> <p>If you have an instance of any model, you can get the list of fields by the <code>$instance-&gt;fields</code> property of that model (from the database table), and use those to create the list for the <code>all_to_array</code> call by creating prefixed names for the included relation.</p> <p>Alternatively, if you only need the <code>[]</code> way of accessing fields, you can implement <code>ArrayAccess</code> interface like this:</p> <pre><code>class DataMapper2 extends DataMapper implements ArrayAccess { public function offsetSet($offset, $value) { if (is_null($offset)) { throw new ErrorException('model instances doesn\'t support pushing new fields'); } else { $this-&gt;{$offset} = $value; } } public function offsetExists($offset) { return isset($this-&gt;{$offset}); } public function offsetUnset($offset) { unset($this-&gt;{$offset}); } public function offsetGet($offset) { return isset($this-&gt;{$offset}) ? $this-&gt;{$offset} : null; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload