Comment
extends PersistentObject
in package
Comment Class
Table of Contents
- $comment_error_text : mixed
- $dataconfirmation : mixed
- $exists : mixed
- $loaded : mixed
- $table : mixed
- $transient : mixed
- $id : mixed
- $cache_by : mixed
- $data : mixed
- $tempdata : mixed
- $unique_set : mixed
- $updates : mixed
- $use_cache : mixed
- __construct() : Comment
- Constructor for a comment
- __toString() : string
- "Magic" function to return a string identifying the object when it is treated as a string
- checkChanges() : bool
- By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
- clearCache() : mixed
- Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
- clearObjectCache() : mixed
- Shortcut to clear the cache of the current object class only
- copy() : mixed
- Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
- get() : mixed
- Get the value of a variable. If $current is false, return the value as of the last save of this object.
- getAnon() : bool
- Returns true if the comment is flagged anonymous
- getComment() : string
- Returns the comment text
- getCustomData() : string
- Returns the custom data field of the comment
- getData() : array<string|int, mixed>
- returns the database record of the object
- getDateTime() : string
- returns the comment date/time
- getEmail() : string
- returns the email address of the commentor
- getID() : string
- Returns the id
- getInModeration() : int
- Returns true if the comment is marked for moderation
- getIP() : string
- Returns the IP address of the comment poster
- getLastChange() : string
- Returns the last change user
- getLastChangeUser() : string
- Returns the last change user
- getName() : string
- Returns the commentor's name
- getOwnerID() : int
- Returns the id of the comment owner
- getPrivate() : bool
- Returns true if the comment is flagged private
- getType() : string
- Returns the 'type' of the comment. i.e. the class of the owner object
- getWebsite() : string
- returns the Website of the commentor
- instantiate() : bool
- }
- move() : mixed
- Change one or more values of the unique set assigned to this record.
- remove() : bool
- Deletes object from the database
- save() : mixed
- Save the updates made to this object since the last update. Returns true if successful, false if not.
- set() : mixed
- Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
- setAnon() : mixed
- Sets the anonymous flag of the comment
- setComment() : mixed
- Stores the comment text
- setCustomData() : mixed
- Stores the custom data field of the comment
- setDateTime() : mixed
- Sets a comment date/time value
- setDefaults() : mixed
- Sets up default items on new comment objects
- setEmail() : mixed
- Sets the email address of the commentor
- setInModeration() : mixed
- Sets the moderation flag of the comment
- setIP() : mixed
- Sets the IP address field of the comment
- setLastChange() : mixed
- stores the current date in the format 'Y-m-d H:i:s' as the last change date
- setLastchangeUser() : mixed
- stores the last change user
- setName() : mixed
- Sets the commentor's name
- setOwnerID() : mixed
- Sets the id of the owner of the comment
- setPrivate() : mixed
- Sets the private flag of the comment
- setType() : mixed
- Sets the 'type' field of the comment
- setWebsite() : mixed
- Stores the website of the commentor
- addToCache() : mixed
- add the entry to the cache
- getFromCache() : mixed
- check the cache for presence of the entry and return it if found
- load() : false
- Load the data array from the database, using the unique id set to get the unique record.
Properties
$comment_error_text
public
mixed
$comment_error_text
= \NULL
$dataconfirmation
public
mixed
$dataconfirmation
= \null
$exists
public
mixed
$exists
= \false
$loaded
public
mixed
$loaded
= \false
$table
public
mixed
$table
$transient
public
mixed
$transient
$id
protected
mixed
$id
= 0
$cache_by
private
mixed
$cache_by
$data
private
mixed
$data
= \NULL
$tempdata
private
mixed
$tempdata
= \NULL
$unique_set
private
mixed
$unique_set
= \NULL
$updates
private
mixed
$updates
= \NULL
$use_cache
private
mixed
$use_cache
= \false
Methods
__construct()
Constructor for a comment
public
__construct([int $id = NULL ]) : Comment
Parameters
- $id : int = NULL
-
set to the ID of the comment if not a new one.
Return values
Comment —__toString()
"Magic" function to return a string identifying the object when it is treated as a string
public
__toString() : string
Return values
string —checkChanges()
By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
public
checkChanges([bool $update = true ]) : bool
This checks that and internally updates the $updates
property with the actual changes obky so you optionally can skip unnecessary object saves.
Standard object fields lastchange
and lastchangeuser
are exclude because lastchange
always changes and both make no sense
if there is no actual content change at all.
This can be used before calling the save() method or enabled within the save() method optionally
Parameters
- $update : bool = true
-
True (default) to also update the $updates property with changes found or clear it. False to only check for changes.
Tags
Return values
bool —clearCache()
Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
public
static clearCache([mixed $class = null ]) : mixed
Note: You normally never need to use this. But on certain occasions it may be necessary to avoid memory issues if you loop through a lot of object creations.
Parameters
- $class : mixed = null
Tags
Return values
mixed —clearObjectCache()
Shortcut to clear the cache of the current object class only
public
clearObjectCache() : mixed
Tags
Return values
mixed —copy()
Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
public
copy(mixed $new_unique_set) : mixed
A call to copy is instant, it does not require a save() following it.
Parameters
- $new_unique_set : mixed
Return values
mixed —get()
Get the value of a variable. If $current is false, return the value as of the last save of this object.
public
get(mixed $var[, mixed $current = true ]) : mixed
Parameters
- $var : mixed
- $current : mixed = true
Return values
mixed —getAnon()
Returns true if the comment is flagged anonymous
public
getAnon() : bool
Return values
bool —getComment()
Returns the comment text
public
getComment() : string
Return values
string —getCustomData()
Returns the custom data field of the comment
public
getCustomData() : string
Return values
string —getData()
returns the database record of the object
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDateTime()
returns the comment date/time
public
getDateTime() : string
Return values
string —getEmail()
returns the email address of the commentor
public
getEmail() : string
Return values
string —getID()
Returns the id
public
getID() : string
Return values
string —getInModeration()
Returns true if the comment is marked for moderation
public
getInModeration() : int
Return values
int —getIP()
Returns the IP address of the comment poster
public
getIP() : string
Return values
string —getLastChange()
Returns the last change user
public
getLastChange() : string
Return values
string —getLastChangeUser()
Returns the last change user
public
getLastChangeUser() : string
Tags
Return values
string —getName()
Returns the commentor's name
public
getName() : string
Return values
string —getOwnerID()
Returns the id of the comment owner
public
getOwnerID() : int
Return values
int —getPrivate()
Returns true if the comment is flagged private
public
getPrivate() : bool
Return values
bool —getType()
Returns the 'type' of the comment. i.e. the class of the owner object
public
getType() : string
Return values
string —getWebsite()
returns the Website of the commentor
public
getWebsite() : string
Return values
string —instantiate()
}
public
instantiate( $tablename, $unique_set[, $cache_by = NULL ][, $use_cache = true ][, $is_transient = false ][, $allowCreate = true ]) : bool
Prime instantiator for Zenphoto objects
Parameters
- $tablename :
-
The name of the database table
- $unique_set :
-
An array of unique fields
- $cache_by : = NULL
- $use_cache : = true
- $is_transient : = false
-
Set true to prevent database insertion
- $allowCreate : = true
-
Set true to allow a new object to be made.
Return values
bool —will be true if the unique_set does not already exist
move()
Change one or more values of the unique set assigned to this record.
public
move(mixed $new_unique_set) : mixed
Checks if the record already exists first, if so returns false. If successful returns true and changes $this->unique_set A call to move is instant, it does not require a save() following it.
Parameters
- $new_unique_set : mixed
Return values
mixed —remove()
Deletes object from the database
public
remove() : bool
Return values
bool —save()
Save the updates made to this object since the last update. Returns true if successful, false if not.
public
save([bool $checkupdates = false ]) : mixed
Parameters
- $checkupdates : bool = false
-
Default false. If true the internal $updates property is checked for actual changes so unnecessary saving is skipped. Applies to already existing objects only.
Return values
mixed —set()
Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
public
set(mixed $var, mixed $value) : mixed
If the requested variable is not in the database, sets it in temp storage, which won't be persisted to the database.
Parameters
- $var : mixed
- $value : mixed
Return values
mixed —setAnon()
Sets the anonymous flag of the comment
public
setAnon(bool $value) : mixed
Parameters
- $value : bool
Return values
mixed —setComment()
Stores the comment text
public
setComment(string $value) : mixed
Parameters
- $value : string
Return values
mixed —setCustomData()
Stores the custom data field of the comment
public
setCustomData(string $value) : mixed
Parameters
- $value : string
Return values
mixed —setDateTime()
Sets a comment date/time value
public
setDateTime(string $datetime) : mixed
Parameters
- $datetime : string
Return values
mixed —setDefaults()
Sets up default items on new comment objects
public
setDefaults() : mixed
Return values
mixed —setEmail()
Sets the email address of the commentor
public
setEmail(string $value) : mixed
Parameters
- $value : string
Return values
mixed —setInModeration()
Sets the moderation flag of the comment
public
setInModeration(int $value) : mixed
Parameters
- $value : int
Return values
mixed —setIP()
Sets the IP address field of the comment
public
setIP(string $value) : mixed
Parameters
- $value : string
Return values
mixed —setLastChange()
stores the current date in the format 'Y-m-d H:i:s' as the last change date
public
setLastChange() : mixed
Return values
mixed —setLastchangeUser()
stores the last change user
public
setLastchangeUser(mixed $a) : mixed
Parameters
- $a : mixed
Tags
Return values
mixed —setName()
Sets the commentor's name
public
setName(string $value) : mixed
Parameters
- $value : string
Return values
mixed —setOwnerID()
Sets the id of the owner of the comment
public
setOwnerID(int $value) : mixed
Parameters
- $value : int
Return values
mixed —setPrivate()
Sets the private flag of the comment
public
setPrivate(bool $value) : mixed
Parameters
- $value : bool
Return values
mixed —setType()
Sets the 'type' field of the comment
public
setType(string $type) : mixed
Parameters
- $type : string
Return values
mixed —setWebsite()
Stores the website of the commentor
public
setWebsite(string $value) : mixed
Parameters
- $value : string
Return values
mixed —addToCache()
add the entry to the cache
private
addToCache( $entry) : mixed
Parameters
Return values
mixed —getFromCache()
check the cache for presence of the entry and return it if found
private
getFromCache() : mixed
Return values
mixed —load()
Load the data array from the database, using the unique id set to get the unique record.
private
load(bool $allowCreate) : false
Parameters
- $allowCreate : bool
-
set to true to enable new object creation.
Return values
false —if the record already exists, true if a new record was created.