Tuskfish API
  • Package
  • Class

Packages

  • content
  • core
  • database
  • installation
  • security
  • user
  • utilities

Classes

  • TfishAncestralObject
  • TfishAngryTree
  • TfishCache
  • TfishFileHandler
  • TfishLogger
  • TfishPreference
  • TfishPreferenceHandler

Functions

  • tfish_autoload

Class TfishAncestralObject

Tuskfish parent data object class.

All content objects are descendants of this class via the first child, TfishContentObject. Object properties are held in a protected store ($__data) and accessed via magic methods. Note that if a subclass implements magical __get() and __set() methods, the parental versions will NOT be called unless you explicitly do it using parent::__get().

Direct known subclasses

TfishContentObject, TfishPreference, TfishRss

Indirect known subclasses

TfishArticle, TfishAudio, TfishBlock, TfishCollection, TfishDownload, TfishImage, TfishStatic, TfishTag, TfishVideo

Package: core
Copyright: Simon Wilkinson 2013-2017 (https://tuskfish.biz)
License: GNU General Public License (GPL) V2
Author: Simon Wilkinson simon@isengard.biz
Version: Release: 1.0
Since: 1.0
Located at trust_path/libraries/tuskfish/class/TfishAncestralObject.php

Methods summary

public array
# getPropertyWhitelist( )

Returns a whitelist of object properties whose values are allowed be set.

Returns a whitelist of object properties whose values are allowed be set.

This function is used to build a list of $allowed_vars for a content object. Child classes use this list to unset properties they do not use. Properties that are not resident in the database are also unset here (handler, template, module and icon).

Returns

array
Array of object properties.
public mixed|null
# __get( string $property )

Get the value of a property.

Get the value of a property.

Intercepts direct calls to access an object property. This method can be overridden to impose processing logic to the value before returning it.

Parameters

$property
Name of property.

Returns

mixed|null
$property Value of property if it is set; otherwise null.
public
# __set( string $property, mixed $value )

Set the value of a whitelisted property.

Set the value of a whitelisted property.

Intercepts direct calls to set the value of an object property. This method is overridden by child classes to impose data type restrictions and range checks before allowing the property to be set. Tuskfish objects are designed not to trust other components; each conducts its own internal validation checks.

Parameters

$property
Name of property.
$value
Value of property.
public boolean
# __isset( string $property )

Check if an object property is set.

Check if an object property is set.

Intercepts isset() calls to correctly read object properties. Can be overridden in child objects to add processing logic for specific properties.

Parameters

$property
Name of property to check.

Returns

boolean
True if set otherwise false.
public boolean
# __unset( string $property )

Unsets a property.

Unsets a property.

Intercepts unset() calls to correctly unset object properties. Can be overridden in child objects to add processing logic for specific properties.

Parameters

$property
Name of property.

Returns

boolean
True on success false on failure.
public array
# toArray( )

Converts a content object to an array suitable for insert/update calls to the database.

Converts a content object to an array suitable for insert/update calls to the database.

Note that the returned array observes the PARENT object's getPropertyWhitelist() as a restriction on the setting of keys. This whitelist explicitly excludes the handler, template and module properties as these are part of the class definition and are not stored in the database. Calling the parent's property whitelist ensures that properties that are unset by child classes are zeroed (this is important when an object is changed to a different subclass, as the properties used may differ).

Returns

array
Array of object property/values.

Properties summary

protected array $__properties

$__properties Whitelist that defines permitted content object properties.

$__properties Whitelist that defines permitted content object properties.

# array()
protected array $__data

Holds values of permitted content object properties, accessed via magic methods.

Holds values of permitted content object properties, accessed via magic methods.

# array()
Tuskfish API API documentation generated by ApiGen