How to organize SQL select functions?
<p>I want to get information by user id, so lets add this to the model:</p>

<pre><code>public function getById ($id)
{
    $sql = 'SELECT * FROM users';
    return ActualDbHander::run($sql);
}
</code></pre>

<p>later, I want to get only some fields:</p>

<pre><code>public function getById ($id, $fields = '*')
{
    $sql = 'SELECT '.$fields.' FROM users';
    return ActualDbHander::run($sql);
}
</code></pre>

<p>another idea, lets add ordering:</p>

<pre><code>public function getById ($id, $fields = '*', $orderBy = '')
{
    $sql = 'SELECT '.$fields.' FROM users';
    if ($orderBy != '')
    {
        $sql.= ' ORDER BY '.$orderBy;
    }
    return ActualDbHander::run($sql);
}
</code></pre>

<p>and I see this becaming messy and messy. What if I want to add JOIN-s? What if I want to add detailed WHERE-s? This is when "too generalic" methods born.</p>