public function getById($id)
    {
        $sql = "SELECT * FROM " . $this->getTable() . " WHERE " . $this->getPrimaryKey() . " = " . intval($id) . ";";

        try {
            $result = $this->db->query($sql);
        } catch (\PDOException $e) {
            throw new DatabaseException($e->getMessage() . '<br>' . $sql);
        }
        return $this->fetchAssoc($result);

    }
public function getById($id)
    {
        $sql = "SELECT * FROM " . $this->getTable() . " WHERE " . $this->getPrimaryKey() . " = " . intval($id) . ";";

        try {
            $result = $this->db->query($sql);
        } catch (\PDOException $e) {
            throw new DatabaseException($e->getMessage() . '<br>' . $sql);
        }
        return $this->fetchAssoc($result);

    }
public function getById ( $ id ) { $ sql = "SELECT * FROM " . $ this -> getTable ( ) . " WHERE " . $ this -> getPrimaryKey ( ) . " = " . intval ( $ id ) . ";" ; try { $ result = $ this -> db -> query ( $ sql ) ; } catch ( \ PDOException $ e ) { throw new DatabaseException ( $ e -> getMessage ( ) . '<br>' . $ sql ) ; } return $ this -> fetchAssoc ( $ result ) ; }
Select a row by id from this table

@param $id

@return array|null
@throws DatabaseException
Select a row by id from this table