\contact

An interface to the contact table in the database

Summary

Methods
Properties
Constants
__construct()
getId()
getClientId()
getClient()
getName()
setName()
getEmail()
setEmail()
getAddress()
setAddress()
getAddress_2()
setAddress_2()
getPostalCode()
setPostalCode()
getCity()
setCity()
getCountry()
setCountry()
getLanguage()
setLanguage()
delete()
createOffer()
No public properties found
No constants found
No protected methods found
$pdo
$id
$clientId
$name
$email
$address
$postal_code
$city
$country
$language
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

$clientId

$clientId : \PDO

Type

\PDO — The PDO class for database communication

$name

$name : \PDO

Type

\PDO — The PDO class for database communication

$email

$email : \PDO

Type

\PDO — The PDO class for database communication

$address

$address : \PDO

Type

\PDO — The PDO class for database communication

$postal_code

$postal_code : \PDO

Type

\PDO — The PDO class for database communication

$city

$city : \PDO

Type

\PDO — The PDO class for database communication

$country

$country : \PDO

Type

\PDO — The PDO class for database communication

$language

$language : \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 contact to fetch

Throws

\PDOException

If something went wrong with the database

\Exception

If the contact could not be found

getId()

getId() : integer

Get the ID of the contact

Returns

integer —

The ID

getClientId()

getClientId() : integer

Get the ID of the client that this contact is linked to

Returns

integer —

The ID

getClient()

getClient() : \client

Get the client that this contact is linked to

Returns

\client

The client

getName()

getName() : string

Get the name of the contact

Returns

string —

The name

setName()

setName(string  $name) : boolean

Set the name of the contact

Parameters

string $name

The new name for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

getEmail()

getEmail() : string

Get the email of the contact

Returns

string —

The email

setEmail()

setEmail(string  $email) : boolean

Set the email of the contact

Parameters

string $email

The new email for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

getAddress()

getAddress() : string

Get the first address line of the contact

Returns

string —

The address

setAddress()

setAddress(string  $address) : boolean

Set the first address line of the contact

Parameters

string $address

The new address for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

getAddress_2()

getAddress_2() : string

Get the second address line of the contact

Returns

string —

The address

setAddress_2()

setAddress_2(string  $address_2) : boolean

Set the second address line of the contact

Parameters

string $address_2

The new address for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

getPostalCode()

getPostalCode() : string

Get the postal_code of the contact

Returns

string —

The postal_code

setPostalCode()

setPostalCode(  $postal_code) : boolean

Set the postal code of the contact

Parameters

$postal_code

string The new postal code for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

getCity()

getCity() : string

Get the city of the contact

Returns

string —

The city

setCity()

setCity(string  $city) : boolean

Set the city of the contact

Parameters

string $city

The new city for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

getCountry()

getCountry() : string

Get the country of the contact

Returns

string —

The country

setCountry()

setCountry(string  $country) : boolean

Set the country of the contact

Parameters

string $country

The new country for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

getLanguage()

getLanguage() : string

Get the language of the contact

Returns

string —

The language

setLanguage()

setLanguage(string  $language) : boolean

Set the language of the contact

Parameters

string $language

The new language for the contact

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on succes, false on failure

delete()

delete() : boolean

Remove this contact from the database

If this doesn't succeed (i.e. false is returned), that means the contact was removed manually or by another instance of this class

Throws

\PDOException

If something went wrong with the database

Returns

boolean —

True on success, false on failure

createOffer()

createOffer() : \offer

Make a new offer for this contact

Throws

\PDOException

If something went wrong with the database

\Exception

If there was a problem with the input

Returns

\offer

A new instance of the offer class containing the new offer