public function get_row(&$counter = 0, $method = null)
{
if (!empty($this->row) && 0 < (int) $this->id && 'table' != $method) {
return $this->row;
}
if (is_object($this->pod) && ('Pods' == get_class($this->pod) || 'Pod' == get_class($this->pod))) {
$this->row = $this->pod->fetch();
} else {
$this->row = false;
if (!empty($this->data)) {
if (empty($this->data_keys) || count($this->data) != count($this->data_keys)) {
$this->data_keys = array_keys($this->data);
}
if (count($this->data) == $this->total && isset($this->data_keys[$counter]) && isset($this->data[$this->data_keys[$counter]])) {
$this->row = $this->data[$this->data_keys[$counter]];
$counter++;
}
}
if (false === $this->row && 0 < (int) $this->id && !empty($this->sql['table'])) {
$this->pods_data->select(array('table' => $this->sql['table'], 'where' => '`' . $this->sql['field_id'] . '` = ' . (int) $this->id, 'limit' => 1));
$this->row = $this->pods_data->fetch();
}
}
return $this->row;
}