public function getDAO(string $class)
    {
        if (!isset($this->dao[$class]))
        {
            if (!is_subclass_of($class, Model::class))
                throw new DAOException("$class is not a valid Model");

            $tablename = $class::getTablename();
            $dao = DI::getInjector()->newInstance(
                DAO::class,
                ['classname' => $class, 'tablename' => $tablename, 'db' => $this]
            );
            $this->dao[$class] = $dao;
        }

        return $this->dao[$class];
    }
public function getDAO(string $class)
    {
        if (!isset($this->dao[$class]))
        {
            if (!is_subclass_of($class, Model::class))
                throw new DAOException("$class is not a valid Model");

            $tablename = $class::getTablename();
            $dao = DI::getInjector()->newInstance(
                DAO::class,
                ['classname' => $class, 'tablename' => $tablename, 'db' => $this]
            );
            $this->dao[$class] = $dao;
        }

        return $this->dao[$class];
    }
public function getDAO ( string $ class ) { if ( ! isset ( $ this -> dao [ $ class ] ) ) { if ( ! is_subclass_of ( $ class , Model :: class ) ) throw new DAOException ( "$class is not a valid Model" ) ; $ tablename = $ class :: getTablename ( ) ; $ dao = DI :: getInjector ( ) -> newInstance ( DAO :: class , [ 'classname' => $ class , 'tablename' => $ tablename , 'db' => $ this ] ) ; $ this -> dao [ $ class ] = $ dao ; } return $ this -> dao [ $ class ] ; }
Get a DAO for a model. When none is available, a new one will be instantiated.

@param string $class The name of the Model class
@return DAO An instantiated DAO for the class.
Get a DAO for a model . When none is available a new one will be instantiated .