$IDFIELD
$IDFIELD : string
The ID field
The permanent entity class
A permanent entity class that combine a PermanentObject with EntityDescriptor's features.
None found |
None found |
None found |
$onSavedInProgress : boolean
Is this object called onSaved ? It prevents recursive calls
None found |
None found |
None found |
set2Array(array $array) : array
Get the object as array
array | $array |
The resulting array
None found |
setTo(array $array)
Insert this object in the given array using its ID as key
array | $array |
None found |
__construct( $data)
Constructor
$data | An array of the object's data to construct |
None found |
None found |
__get(string $name) : \Orpheus\Publisher\PermanentObject\The
Magic getter
string | $name | Name of the property to get |
value of field $name
Get the value of field $name. 'all' returns all fields.
None found |
__set( $name, $value)
Magic setter
$name | Name of the property to set |
|
$value | New value of the property Sets the value of field $name. |
None found |
__isset( $name)
Magic isset
$name | Name of the property to check is set Checks if the field $name is set. |
None found |
__toString() : \Orpheus\Publisher\PermanentObject\The
Magic toString
string value of the object.
The object's value when casting to string.
None found |
id() : \Orpheus\Publisher\PermanentObject\The
Get this permanent object's ID
id of this object.
Get this object ID according to the IDFIELD attribute.
None found |
uid() : \Orpheus\Publisher\PermanentObject\The
Get this permanent object's unique ID
uid of this object.
Get this object ID according to the table and id.
None found |
update(array $input, array<mixed,string> $fields, boolean $noEmptyWarning = true, \Orpheus\Publisher\PermanentObject\&int $errCount, \Orpheus\Publisher\PermanentObject\&int $successCount) : \Orpheus\Publisher\PermanentObject\1
Update this permanent object from input data array
array | $input | The input data we will check and extract, used by children |
array<mixed,string> | $fields | The array of fields to check |
boolean | $noEmptyWarning | True to do not report warning for empty data (instead return 0). Default value is true. |
\Orpheus\Publisher\PermanentObject\&int | $errCount | Output parameter for the number of occurred errors validating fields. |
\Orpheus\Publisher\PermanentObject\&int | $successCount | Output parameter for the number of successes updating fields. |
in case of success, else 0.
overrideit |
This method require to be overridden but it still be called too by the child classes. Here $input is not used, it is reserved for child classes. $data must contain a filled array of new data. This method update the EDIT event log. Before saving, runForUpdate() is called to let child classes to run custom instructions. Parameter $fields is really useful to allow partial modification only (against form hack). |
---|
getUpdateOperation(array $input, array<mixed,string> $fields) : \Orpheus\Publisher\Transaction\UpdateTransactionOperation
Get the update operation
array | $input | The input data we will check and extract, used by children |
array<mixed,string> | $fields | The array of fields to check |
None found |
onValidUpdate(array $input, integer $newErrors) : boolean
Callback when validating update
array | $input | |
integer | $newErrors |
None found |
extractUpdateQuery(array $input, \Orpheus\Publisher\PermanentObject\PermanentObject $object) : array
Extract an update query from this object
array | $input | |
\Orpheus\Publisher\PermanentObject\PermanentObject | $object |
None found |
getDeleteOperation() : \Orpheus\Publisher\Transaction\DeleteTransactionOperation
Get the delete operation for this object
None found |
runForUpdate( $data, $oldData)
Run for Update
$data | the new data |
|
$oldData | the old data |
None found |
onEdit(array $data, \Orpheus\Publisher\PermanentObject\PermanentObject $object)
Run for Object edit
array | $data | the new data |
\Orpheus\Publisher\PermanentObject\PermanentObject | $object | the old data |
None found |
onValidateInput(array $input, array $fields, \Orpheus\Publisher\PermanentObject\PermanentObject $object)
Callback when validating input
array | $input | |
array | $fields | |
\Orpheus\Publisher\PermanentObject\PermanentObject | $object |
None found |
onSaved(array $data, integer|\Orpheus\Publisher\PermanentObject\PermanentObject $object)
Callbakc when object was saved
array | $data | |
integer|\Orpheus\Publisher\PermanentObject\PermanentObject | $object |
None found |
save() : boolean
Save this permanent object
True in case of success
If some fields was modified, it saves these fields using the SQL Adapter.
None found |
None found |
None found |
None found |
reload(string $field = null) : boolean
Reload fields from database
string | $field | The field to reload, default is null (all fields). |
True if done
Update the current object's fields from database. If $field is not set, it reloads only one field else all fields. Also it removes the reloaded fields from the modified ones list.
None found |
isDeleted() : boolean
Check if this object is deleted
True if this object is deleted
Checks if this object is known as deleted.
None found |
isValid() : boolean
Check if this object is valid
True if this object is valid
Check if this object is not deleted. May be used for others cases.
None found |
warning |
Be sure what you are doing before calling this function (never out of this class' context). Mark this object as deleted |
---|
getValue( $key = null) : mixed
Get one value or all values
$key | Name of the field to get. |
Get the value of field $key or all data values if $key is null.
None found |
setValue(string $key, mixed $value) : \Orpheus\Publisher\PermanentObject\PermanentObject
Set the value of a field
string | $key | Name of the field to set |
mixed | $value | New value of the field |
Set the field $key with the new $value.
None found |
equals(object $o) : boolean
Verify equality with another object
object | $o | The object to compare. |
True if this object represents the same data, else False.
Compare the class and the ID field value of the 2 objects.
None found |
logEvent(string $event, integer $time = null, string $ipAdd = null)
Log an event
string | $event | The event to log in this object |
integer | $time | A specified time to use for logging event |
string | $ipAdd | A specified IP Adress to use for logging event |
None found |
fillLogEvent(array $array, string $event)
Add an $event log in this $array
array | $array | |
string | $event |
None found |
getLogEvent(string $event, integer $time = null, string $ipAdd = null)
Get the log of an event
string | $event | The event to log in this object |
integer | $time | A specified time to use for logging event |
string | $ipAdd | A specified IP Adress to use for logging event |
None found |
object(\Orpheus\Publisher\PermanentObject\PermanentObject|integer $obj) : \Orpheus\Publisher\PermanentObject\PermanentObject
Get the object whatever we give to it
\Orpheus\Publisher\PermanentObject\PermanentObject|integer | $obj |
None found |
isFieldEditable(string $fieldname) : boolean
Test if $fieldname is editable
string | $fieldname |
None found |
get(array $options = NULL) : \Orpheus\SQLRequest\SQLSelectRequest|static|array<mixed,static>
Get some permanent objects
array | $options | The options used to get the permanents object |
An array of array containing object's data
None found |
load(mixed|array<mixed,mixed> $in, boolean $nullable = true, boolean $usingCache = true) : \Orpheus\Publisher\PermanentObject\PermanentObject
Load a permanent object
mixed|array<mixed,mixed> | $in | The object ID to load or a valid array of the object's data |
boolean | $nullable | True to silent errors row and return null |
boolean | $usingCache | True to cache load and set cache, false to not cache |
The object
None found |
cacheObjects(array $objects) : array
Cache an array of objects
array | $objects |
None found |
getCacheStats() : \Orpheus\Publisher\PermanentObject\PermanentObject
Get cache stats
None found |
delete(integer $in) : integer
Delete a permanent object
integer | $in | The object ID to delete or the delete array. |
The number of deleted rows.
None found |
None found |
None found |
None found |
escapeIdentifier(string $identifier = null) : string
Escape identifier through instance
string | $identifier | The identifier to escape. Default is table name. |
The escaped identifier
None found |
ei(string $identifier = null) : string
Escape identifier through instance
string | $identifier | The identifier to escape. Default is table name. |
The escaped identifier
None found |
formatValue(scalar $value) : string
Escape value through instance
scalar | $value | The value to format |
The formatted $Value
None found |
fv(scalar $value) : string
Escape value through instance
scalar | $value | The value to format |
The formatted $Value
None found |
formatValueList(array $list) : string
Escape values through instance and return as list string
array | $list | The list of values |
The formatted list string
todo |
Change to use formatFieldValue($name, $value) ? |
---|
create(array $input = array(), array $fields = null, integer $errCount) : integer
Create a new permanent object
array | $input | The input data we will check, extract and create the new object. |
array | $fields | The array of fields to check. Default value is null. |
integer | $errCount | Output parameter to get the number of found errors. Default value is 0 |
The ID of the new permanent object.
None found |
getCreateOperation(array $input, array<mixed,string> $fields) : \Orpheus\Publisher\Transaction\CreateTransactionOperation
Get the create operation
array | $input | The input data we will check and extract, used by children |
array<mixed,string> | $fields | The array of fields to check |
None found |
onValidCreate(array $input, integer $newErrors) : boolean
Callback when validating create
array | $input | |
integer | $newErrors |
None found |
extractCreateQuery(array $input) : array
Extract a create query from this class
array | $input |
None found |
createAndGet(array $input = array(), array|null $fields = null, integer $errCount) : \Orpheus\Publisher\PermanentObject\PermanentObject
Create a new permanent object
array | $input | The input data we will check, extract and create the new object. |
array|null | $fields | The array of fields to check. Default value is null. |
integer | $errCount | Output parameter to get the number of found errors. Default value is 0 |
The new permanent object
None found |
completeFields(array $data) : array
Complete missing fields
array | $data | The data array to complete. |
The completed data array.
Complete an array of data of an object of this class by setting missing fields with empty string.
None found |
None found |
None found |
getTable() : \Orpheus\Publisher\PermanentObject\The
Get the table of this class
table of this class.
None found |
getIDField() : \Orpheus\Publisher\PermanentObject\The
Get the ID field name of this class
ID field of this class.
None found |
getDomain() : \Orpheus\Publisher\PermanentObject\The
Get the domain of this class
domain of this class.
Get the domain of this class, can be guessed from $table or specified in $domain.
None found |
getValidator() : \Orpheus\Publisher\PermanentObject\The
Get the validator of this class
validator of this class.
Get the validator of this class.
None found |
None found |
applyToObject( $data, $id)
Apply for new object
$data | The new data to process. |
|
$id | The ID of the new object. |
None found |
checkUserInput(array $input, array<mixed,string> $fields = null, \Orpheus\Publisher\PermanentObject\PermanentObject $ref = null, integer $errCount) : \Orpheus\Publisher\PermanentObject\The
Check user input
array | $input | The user input data to check. |
array<mixed,string> | $fields | The array of fields to check. Default value is null. |
\Orpheus\Publisher\PermanentObject\PermanentObject | $ref | The referenced object (update only). Default value is null. |
integer | $errCount | The resulting error count, as pointer. Output parameter. |
valid data.
Check if the class could generate a valid object from $input. The method could modify the user input to fix them but it must return the data. The data are passed through the validator, for different cases:
None found |
checkForObject( $data, $ref = null)
Check for object
$data | The new data to process. |
|
$ref | The referenced object (update only). Default value is null. |
None found |
testUserInput( $input, $fields = null, $ref = null, $errCount)
Test user input
$input | The new data to process. |
|
$fields | The array of fields to check. Default value is null. |
|
$ref | The referenced object (update only). Default value is null. |
|
$errCount | The resulting error count, as pointer. Output parameter. |
None found |
getClassData(array $classData = null) : array
Get all gathered data about this class
array | $classData |
None found |
getSQLAdapter() : \Orpheus\SQLAdapter\SQLAdapter
Get the SQL Adapter of this class
None found |
init(string $isFinal = true)
Initializes class
string | $isFinal | Is this class final ? Initialize entity class You must call this method after the class declaration |
None found |
throwException(string $message)
Throw an UserException
string | $message | the text message, may be a translation string |
None found |
throwNotFound(string $message = null)
Throw a NotFoundException
string | $message | the text message, may be a translation string |
None found |
text(string $text, array|string $values = array()) : string
Translate text according to the object domain
string | $text | The text to translate |
array|string | $values | The values array to replace in text. Could be used as second parameter. |
The translated text
None found |
_text(\Orpheus\Publisher\PermanentObject\sting $text, array|string $values = array())
Translate text according to the object domain
\Orpheus\Publisher\PermanentObject\sting | $text | The text to translate |
array|string | $values | The values array to replace in text. Could be used as second parameter. |
None found |
None found |
getCreateTime() : integer
Get unix timestamp from the create_date field
warning |
You can not use this function if there is no create_date field |
---|
validateValue(string $field, mixed $value)
Validate field value from the validator using this entity
string | $field | |
mixed | $value |
None found |
putValue(string $field, mixed $value)
Validate field value and set it
string | $field | |
mixed | $value |
None found |
loadEntity(string $entity, integer $id)
Try to load entity from an entity string and an id integer
string | $entity | |
integer | $id |
None found |
getEntityObject(string $objType, string $objID = null) : \Orpheus\EntityDescriptor\PermanentEntity
Get entity instance by type and id
string | $objType | |
string | $objID |
None found |
getEntityWhereclause(string $prefix = '') : string
Helper method to get whereclause string from an entity
string | $prefix | The prefix for fields, e.g "table." (with dot) |
Helper method to get whereclause string from an entity. The related entity should have entity_type and entity_id fields.
None found |
getField(string $field) : \Orpheus\EntityDescriptor\FieldDescriptor
Get field descriptor from field name
string | $field |
None found |
None found |
listKnownEntities() : array<mixed,string>
List all known entities
None found |
addModFields( $field)
Mark the field as modified
$field | The field to mark as modified. Adds the $field to the modified fields array. |
None found |
listModifiedFields() : array<mixed,string>
List all modified fields
None found |
None found |
checkCache() : \Orpheus\Publisher\PermanentObject\PermanentObject
Check if this object is cached and cache it
None found |
parseFieldValue(string $name, string $value) : string
Parse the value from SQL scalar to PHP type
string | $name | The field name to parse |
string | $value | The field value to parse |
The parse $value
None found |