title: How should a model be structured in MVC?
body: <p>I am just getting a grasp on the MVC framework and I often wonder how much code should go in the model. I tend to have a data access class that has methods like this:</p>
  
  <pre><code>public function CheckUsername($connection, $username)
  {
      try
      {
          $data = array();
          $data['Username'] = $username;
  
          //// SQL
          $sql = "SELECT Username FROM" . $this-&gt;usersTableName . " WHERE Username = :Username";
  
          //// Execute statement
          return $this-&gt;ExecuteObject($connection, $sql, $data);
      }
      catch(Exception $e)
      {
          throw $e;
      }
  }
  </code></pre>
  
  <p>My models tend to be an entity class that is mapped to the database table.</p>
  
  <p>Should the model object have all the database mapped properties as well as the code above or is it OK to separate that code out that actually does the database work?</p>
  
  <p>Will I end up having four layers?</p>