Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 551 Bytes

File metadata and controls

23 lines (19 loc) · 551 Bytes

Abstract Object

Provides access to protected member $db. Use it in any class that needs a database object.

Example

use WebServCo\Framework\Exceptions\DatabaseException;

class MyClass extends \WebServCo\Framework\Database\AbstractObject
{
    public function getitems()
    {
        try {
            return $this->db->query(...);
        } catch (DatabaseException $e) {
            // rethrow in order to pinpoint the query location in the logs.
            throw new DatabaseException($e->getMessage(), $e);
        }
    }
}