O'Reilly logo

PHP Application Development with NetBeans Beginner's Guide by M A Hossain Tonu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating the User Dao class

We will keep the relevant user constants as class constants. We will write the implementation of the methods from the BaseDao abstract class in this class. Simply, we will add the body of those abstract methods and our own methods required into the class. So, follow the steps listed here:

  1. Create a new PHP file inside the Dao directory named UserDao.php, and type in the following code:
    <?php
    namespace My\Dao;
    class UserDao extends BaseDao {
    private $db = null;
    public function __construct() {
    $this->db = $this->getDb();
    }
    }
    $userDao = new \My\Dao\UserDao;
    ?>
    

    As you can see, the class is under the My\Dao namespace and extends to the BaseDao class, so the class will have methods inherited from the parent. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required