Example #1
0
 /**
  * @param   mixed $offset
  * @return  Model|Model[]
  */
 public function offsetGet($offset)
 {
     $return = parent::offsetGet($offset);
     // Slightly dodgy shim to check if what we're getting is an array of results, or just a result.
     $key1 = array_keys($return)[0];
     if (is_int($key1)) {
         $result = [];
         foreach ($return as $idx => $item) {
             $result[$idx] = $this->buildInstance($idx, $item);
         }
     } else {
         $result = $this->buildInstance($offset, $return);
     }
     return $result;
 }