\file

An interface to the file table in the database

Summary

Methods
Properties
Constants
__construct()
getId()
getFilename()
getFilenamePath()
getFilenameURI()
delete()
No public properties found
No constants found
No protected methods found
$pdo
$id
$filename
N/A
No private methods found
No private properties found
N/A

Properties

$pdo

$pdo : \PDO

Type

\PDO — The PDO class for database communication

$id

$id : \PDO

Type

\PDO — The PDO class for database communication

$filename

$filename : \PDO

Type

\PDO — The PDO class for database communication

Methods

__construct()

__construct(\PDO  $pdo, integer  $id) 

Create a new instance

Parameters

\PDO $pdo

The PDO class, to access the database

integer $id

The id of the file to fetch

Throws

\PDOException

If something went wrong with the database

\Exception

If the file could not be found

getId()

getId() : integer

Get the ID of the file

Returns

integer —

The ID

getFilename()

getFilename() : string

Get the relative filename of the file

Returns

string —

The filename

getFilenamePath()

getFilenamePath() : string

Get the full internal path to the file

Returns

string —

The path

getFilenameURI()

getFilenameURI() : string

Get the full external path to the file

Returns

string —

The URI

delete()

delete() : boolean

Move this file to the trash and delete all records for it

Physically, this moves the file to a trash folder Then, the file will be removed from the file table in the database Any appendices linking to this file with fileId will have fileId NULL Any offers linking to this file with invoice_fileId will have invoice_fileId NULL

Throws

\PDOException

If there's something wrong with the database

Returns

boolean —

True on success, false on failure