Which way is better for db handler?
It is fine and very convenient to keep the database handler as a property.  However, you should pass it in the constructor via dependency injection, rather than call it's factory method inside the class.  This can ease unit testing when you need to mock a database connection object.

public function __construct($db) {
    $this-&gt;db = $db;
}