
Public Member Functions | |
| getName () | |
| Implemented to get localized programatically if not set. | |
| creatingDatabaseInstance ($name) | |
| Called when the database is about to be created by the factory. | |
| createdDatabaseInstance ($name, spunQ_IDatabaseConnection $connection) | |
| Called when the database connection has been established. | |
| setId ($id) | |
| Setter for the id. | |
| getId () | |
| Getter for the id. | |
| store () | |
| Will either insert or update a row in the database. | |
| insert () | |
| Will insert this object into the database. | |
| delete () | |
| Will remove this object from the database. | |
| update () | |
| Will Update the members of this object in the database. | |
| assureExists () | |
| Throws an exception if this object does not exist in the database. | |
| setConnection (spunQ_IDatabaseConnection $connection) | |
| Sets the connection that is persisting this object. | |
| getConnection () | |
| Gets the connection that is persisting this object. | |
| handleSet ($memberName, $arguments, $functionName) | |
| Overridden to mark the member as locally modified. | |
| _loadRemoteValues (array $values, $checkValues=true) | |
| Loads members that have been fetched with a query. | |
| _invalidateRemoteValues (array $memberNames) | |
| _getDisplayString () | |
| Gets the human readable object name of this object. | |
| _remoteValueLoaded ($memberName) | |
| Cheks whether a remote value for given member was loaded. | |
| referencingObjects ($otherType, $otherMember, $order=NULL, $limit=NULL) | |
| Gets the objects having the current one associated. | |
| referencingObjectIds ($otherType, $otherMember, $order=NULL, $limit=NULL) | |
| Gets the objects having the current one associated. | |
| countReferencingObjects ($otherType, $otherMember) | |
| Counts the objects having the current one associated. | |
| __call ($functionName, $arguments) | |
| Overloaded to provide automatic getters and setters. | |
| __sleep () | |
| Replaces $_type with the type's name. | |
| _verifyMembers ($omittedMembers=array(), $throwException=true) | |
| Verifies that all members are valid. | |
| _getMember ($name) | |
| Gets the value of a member of this object. | |
| _setMember ($name, $value) | |
| Sets the value of a member of this object. | |
| _getType ($throwException=true) | |
| Gets the type of this object. | |
Static Public Member Functions | |
| static | getSystemLocale () |
| Will get the system locale. | |
| static | getMostAppropriateRfcLocale ($locale, array $possibleLocales, $fallbackLocale=NULL) |
| Will choose a locale best related to given language. | |
| static | getByRfcName ($rfcName, $throwException=true) |
| Gets the object with given rfc name. | |
| static | getByShortName ($shortName, $throwException=true) |
| Gets the object with given short name. | |
| static | getAll () |
| Gets all available locales indexed by their rfc name. | |
| static | insertMultiple (array $objects, spunQ_IDatabaseConnection $connection=NULL) |
| Updates multiple objects at once. | |
| static | updateMultiple (array $objects) |
| Updates multiple objects at once. | |
| static | deleteMultiple (array $objects) |
| Deletes multiple objects at once. | |
| static | sortByDisplayString ($objects) |
| Sorts storable objects by their object names. | |
| static | valueByProperty ($value, $path) |
| Transforms a value using a property path. | |
| static | propertyOfValue ($value, $property) |
| Gets a single property of a value. | |
Public Attributes | |
| const | DEFAULT_SPUNQ_LOCALE = 'de-at' |
| The default system locale. | |
Protected Member Functions | |
| loadMember ($memberName) | |
| Fetches the value of a member of this object from the database. | |
| handleGet ($memberName, $arguments, $functionName) | |
| Overridden to possibly retrieve the value from the database. | |
| handleAdd ($memberName, $arguments, $functionName) | |
| Overridden to fetch data before manipulation. | |
| handleRemove ($memberName, $arguments, $functionName) | |
| Overridden to fetch data before manipulation. | |
| handleGetUntranslated ($memberName, $arguments, $functionName) | |
| Overridden to fetch data. | |
| handleGetFromArray ($memberName, $arguments, $functionName) | |
| Overridden to fetch data. | |
| initLocalizedMember ($memberName) | |
| Makes sure a localized member contains a spunQ_Map. | |
Static Protected Member Functions | |
| static | loadInjectedMember ($connection, spunQ_InjectedMember $injectedMember) |
| Loads injected members for several objects. | |
Protected Attributes | |
| $rfcName | |
| RFC 4646 name of the locale. | |
| $shortName | |
| $name | |
| The localized name of this locale (English, Deutsch, Francais, . | |
| $possibleFallbacks = array() | |
| List of Locales that can be used instead of this one. | |
| $id | |
| The unique id of this object. | |
| $remoteValues = array() | |
| Members that have been loaded from the database. | |
| $locallyModifiedMembers = array() | |
| $connection = NULL | |
| The connection that is persisting this object. | |
| $_type | |
| The actual type of this object. | |
Static Protected Attributes | |
| static | $system = NULL |
| The locale to output the system's messages in. | |
Static Private Member Functions | |
| static | init () |
| Initializes $allByShortName and $allByRfcName if not already done so. | |
Static Private Attributes | |
| static | $allByRfcName = NULL |
| Holds all objects, indexed by their rfc name. | |
| static | $allByShortName = NULL |
| Holds all objects, indexed by their short name. | |
The rfc referred to in this class RFC 4646.
Definition at line 7 of file Locale.type.php.
| spunQ_DataObject::__call | ( | $ | functionName, | |
| $ | arguments | |||
| ) | [inherited] |
Overloaded to provide automatic getters and setters.
| $functionName | The function that was called. | |
| $arguments | Array containing the arguments that were passed to the function. |
| spunQ_BadArgumentCountError |
Definition at line 148 of file DataObject.type.php.
| spunQ_DataObject::__sleep | ( | ) | [inherited] |
Replaces $_type with the type's name.
Reimplemented in spunQ_ArrayType, spunQ_MapType, and spunQ_SetType.
Definition at line 178 of file DataObject.type.php.
| spunQ_StorableObject::_getDisplayString | ( | ) | [inherited] |
Gets the human readable object name of this object.
Reimplemented in spunQ_LoginUser, and spunQ_User.
Definition at line 427 of file StorableObject.type.php.
| spunQ_DataObject::_getMember | ( | $ | name | ) | [inherited] |
Gets the value of a member of this object.
Will check if the object has a getter for the member and will use that method for getting the value. Otherwise, the value of the object member is returned.
| $name | The name of the member. |
Definition at line 478 of file DataObject.type.php.
| spunQ_DataObject::_getType | ( | $ | throwException = true |
) | [inherited] |
Gets the type of this object.
Definition at line 507 of file DataObject.type.php.
| spunQ_StorableObject::_loadRemoteValues | ( | array $ | values, | |
| $ | checkValues = true | |||
| ) | [inherited] |
Loads members that have been fetched with a query.
This function is only intended to process the objects own members. It will handle concatenated member names incorrectly (i.e. origin.country.name will not work as expected.) This behaviour is expected to change in future releases, though.
| $values | An entry in an array that was returned by spunQ_ISelectQuery::execute() with a return mode of RETURN_ARRAY. | |
| $checkValues | Whether the values should be run through the check() functions of the members types. This value will be ignored in deployment mode, so it is generally advised to leave this as-is. Its purpose is to speed up the framework in development mode. |
Definition at line 394 of file StorableObject.type.php.
| spunQ_StorableObject::_remoteValueLoaded | ( | $ | memberName | ) | [inherited] |
Cheks whether a remote value for given member was loaded.
A remote value can only be loaded using _loadRemoteValues().
Definition at line 453 of file StorableObject.type.php.
| spunQ_DataObject::_setMember | ( | $ | name, | |
| $ | value | |||
| ) | [inherited] |
Sets the value of a member of this object.
Will check if the object has a setter for the member and will use that method for setting the value. Otherwise, the object member is set directly.
| $name | The name of the member. | |
| $value | The value to set it to. |
Definition at line 495 of file DataObject.type.php.
| spunQ_DataObject::_verifyMembers | ( | $ | omittedMembers = array(), |
|
| $ | throwException = true | |||
| ) | [inherited] |
Verifies that all members are valid.
This function is called from various modules prior to critical actions requiring a complete object - like inserting into a database.
| $omittedMembers | Do not perform checks on these member names. | |
| $throwException | Whether an exception should be thrown if a member does not have a valid value. |
| spunQ_IllegalValueException |
Definition at line 458 of file DataObject.type.php.
| spunQ_StorableObject::assureExists | ( | ) | [inherited] |
Throws an exception if this object does not exist in the database.
Will try to fetch some members for this object. Note that one should not rely on the result of this method. The entry in the database could be deleted even before this function returns (a typical race condition).
Definition at line 336 of file StorableObject.type.php.
| spunQ_Locale::createdDatabaseInstance | ( | $ | name, | |
| spunQ_IDatabaseConnection $ | connection | |||
| ) |
Called when the database connection has been established.
| $name | Name of the connection. | |
| $connection | The connection object that was created. |
Implements spunQ_IDatabaseInstantiationListener.
Definition at line 199 of file Locale.type.php.
| spunQ_Locale::creatingDatabaseInstance | ( | $ | name | ) |
Called when the database is about to be created by the factory.
| $name | Name of the connection. |
Implements spunQ_IDatabaseInstantiationListener.
Definition at line 192 of file Locale.type.php.
| spunQ_StorableObject::delete | ( | ) | [inherited] |
Will remove this object from the database.
Definition at line 294 of file StorableObject.type.php.
| static spunQ_StorableObject::deleteMultiple | ( | array $ | objects | ) | [static, inherited] |
Deletes multiple objects at once.
Using this function instead of calling delete() on all objects can lead to a performance increase.
| $objects | The objects to delete. |
| spunQ_InvalidArgumentError | If the objects are managed by different connections. |
Definition at line 107 of file StorableObject.type.php.
| static spunQ_Locale::getAll | ( | ) | [static] |
Gets all available locales indexed by their rfc name.
Definition at line 131 of file Locale.type.php.
| static spunQ_Locale::getByRfcName | ( | $ | rfcName, | |
| $ | throwException = true | |||
| ) | [static] |
Gets the object with given rfc name.
| $rfcName | The rfc name of the locale to get. | |
| $throwException | Whether the function should throw an exception if an object with given rfc name was not found. |
| spunQ_InvalidArgumentError | if $verify was set and the rfc name was not found in the database. |
Definition at line 96 of file Locale.type.php.
| static spunQ_Locale::getByShortName | ( | $ | shortName, | |
| $ | throwException = true | |||
| ) | [static] |
Gets the object with given short name.
| $shortName | The short name of the locale to get. | |
| $throwException | Whether the function should throw an exception if an object with given short name was not found. |
| spunQ_InvalidArgumentError |
Definition at line 116 of file Locale.type.php.
| spunQ_StorableObject::getConnection | ( | ) | [inherited] |
Gets the connection that is persisting this object.
Definition at line 364 of file StorableObject.type.php.
| spunQ_StorableObject::getId | ( | ) | [inherited] |
| static spunQ_Locale::getMostAppropriateRfcLocale | ( | $ | locale, | |
| array $ | possibleLocales, | |||
| $ | fallbackLocale = NULL | |||
| ) | [static] |
Will choose a locale best related to given language.
This is very useful, if there are multiple locales to choose from and one wants to find the most 'compatible' one.
| $locale | The ideal locale | |
| $possibleLocales | A list of locales to choose from. | |
| $fallbackLocale | This will be returned if nothing appropriate was found. |
Definition at line 79 of file Locale.type.php.
| spunQ_Locale::getName | ( | ) |
Implemented to get localized programatically if not set.
The intl extension's function Locale::getDisplayLanguage() is used to determine the name of the language.
Definition at line 181 of file Locale.type.php.
| static spunQ_Locale::getSystemLocale | ( | ) | [static] |
Will get the system locale.
The rfc name of the system locale needs to be defined globally as SPUNQ_SYSTEM_LOCALE
before spunQ initialization, so we can localize any messages during spunQ::init(). Defaults to self::DEFAULT_SPUNQ_LOCALE.
Definition at line 43 of file Locale.type.php.
| static spunQ_Locale::init | ( | ) | [static, private] |
Initializes $allByShortName and $allByRfcName if not already done so.
Definition at line 140 of file Locale.type.php.
| spunQ_DataObject::initLocalizedMember | ( | $ | memberName | ) | [protected, inherited] |
Makes sure a localized member contains a spunQ_Map.
| $memberName | The name of the member. This member must have the option 'localized'. |
Definition at line 245 of file DataObject.type.php.
| spunQ_StorableObject::insert | ( | ) | [inherited] |
Will insert this object into the database.
Definition at line 285 of file StorableObject.type.php.
| static spunQ_StorableObject::insertMultiple | ( | array $ | objects, | |
| spunQ_IDatabaseConnection $ | connection = NULL | |||
| ) | [static, inherited] |
Updates multiple objects at once.
Using this function instead of calling insert() on all objects can lead to a performance increase.
WARNING: The objects passed as first parameter must have the same type. WARNING: This function will set the objects' $connection attribute to the given value.
| $objects | The objects to insert. | |
| $connection | The database connection to use for persisting the objects. The default connection will be used if omitted. |
Definition at line 37 of file StorableObject.type.php.
| static spunQ_StorableObject::loadInjectedMember | ( | $ | connection, | |
| spunQ_InjectedMember $ | injectedMember | |||
| ) | [static, protected, inherited] |
Loads injected members for several objects.
| $connection | Connection to use for queries. | |
| $injectedMember | The member to load. return void |
Definition at line 181 of file StorableObject.type.php.
| spunQ_StorableObject::loadMember | ( | $ | memberName | ) | [protected, inherited] |
Fetches the value of a member of this object from the database.
| $memberName | The name of the member to load. |
Definition at line 491 of file StorableObject.type.php.
| static spunQ_DataObject::propertyOfValue | ( | $ | value, | |
| $ | property | |||
| ) | [static, inherited] |
Gets a single property of a value.
| $value | The value to fetch property for. | |
| $property | The property to fetch. |
Definition at line 74 of file DataObject.type.php.
| spunQ_StorableObject::setConnection | ( | spunQ_IDatabaseConnection $ | connection | ) | [inherited] |
Sets the connection that is persisting this object.
| $connection | The connection managing $this. |
Definition at line 349 of file StorableObject.type.php.
| spunQ_StorableObject::setId | ( | $ | id | ) | [inherited] |
Setter for the id.
This function is called very frequently - this implemetation is in fact an optimization (otherwise we'd run through spunQ_DataObject::__call() each time).
Definition at line 256 of file StorableObject.type.php.
| static spunQ_StorableObject::sortByDisplayString | ( | $ | objects | ) | [static, inherited] |
Sorts storable objects by their object names.
| $objects | an array of storable objects. |
Definition at line 158 of file StorableObject.type.php.
| spunQ_StorableObject::store | ( | ) | [inherited] |
Will either insert or update a row in the database.
Definition at line 273 of file StorableObject.type.php.
| spunQ_StorableObject::update | ( | ) | [inherited] |
Will Update the members of this object in the database.
Definition at line 303 of file StorableObject.type.php.
| static spunQ_StorableObject::updateMultiple | ( | array $ | objects | ) | [static, inherited] |
Updates multiple objects at once.
Using this function instead of calling update() on all objects can lead to a performance increase.
| $objects | The objects to update. |
| spunQ_InvalidArgumentError | If the objects are managed by different connections. |
Definition at line 77 of file StorableObject.type.php.
| static spunQ_DataObject::valueByProperty | ( | $ | value, | |
| $ | path | |||
| ) | [static, inherited] |
Transforms a value using a property path.
Some types are considered to have properties within spunQ. These properties can be referred to using property path definitions. The most simple case for properties is the user type, for which every member is considered a property. Concatenations of these paths with dots as separators are called property path. The list of all users in the primary group of a given user can be described using this method in a string: 'primaryGroup.users'.
Different types have different properties:
_keys: An array of the keys of the map._values: An array of the values of the map. Note that _keys and _values are guaranteed to return arrays where the index of a key matches the index of its value in the according result._key: The first entry of the _keys property. This is handy for referencing the key of single key/value pairs._value: The first entry of the _values property._count: The amount of items in the map._keys: The array of keys of the array. Note that the difference between arrays and maps in spunQ is that arrays are always numerically indexed! So this will always return an array containing a range of integers._values: Array of values in this array. This essentially returns the array as-is and is a NOOP._key: The first entry of the _keys property._value: The first entry of the _values property._count: The amount of items in the array._length: The length of the string.| $value | The value to transform | |
| $path | The property path to use for the transformation. This can either be a string as described, or an array, each entry holding a property name. |
Definition at line 54 of file DataObject.type.php.
spunQ_DataObject::$_type [protected, inherited] |
spunQ_Locale::$allByRfcName = NULL [static, private] |
Holds all objects, indexed by their rfc name.
Definition at line 27 of file Locale.type.php.
spunQ_Locale::$allByShortName = NULL [static, private] |
Holds all objects, indexed by their short name.
Definition at line 33 of file Locale.type.php.
spunQ_StorableObject::$connection = NULL [protected, inherited] |
The connection that is persisting this object.
Definition at line 247 of file StorableObject.type.php.
spunQ_StorableObject::$id [protected, inherited] |
The unique id of this object.
Having a base class for all storable objects which holds an id has an important side effect: The id is unique across all tables. integer
Definition at line 228 of file StorableObject.type.php.
spunQ_Locale::$name [protected] |
The localized name of this locale (English, Deutsch, Francais, .
..)
Definition at line 166 of file Locale.type.php.
spunQ_Locale::$possibleFallbacks = array() [protected] |
List of Locales that can be used instead of this one.
Stored in order of preference.
Definition at line 173 of file Locale.type.php.
spunQ_StorableObject::$remoteValues = array() [protected, inherited] |
Members that have been loaded from the database.
map<string,any>
Definition at line 235 of file StorableObject.type.php.
spunQ_Locale::$rfcName [protected] |
spunQ_Locale::$shortName [protected] |
spunQ_Locale::$system = NULL [static, protected] |
The locale to output the system's messages in.
Defined by the configuration value spunQ.locale. Exception messages are translated into this language.
Definition at line 21 of file Locale.type.php.
| const spunQ_Locale::DEFAULT_SPUNQ_LOCALE = 'de-at' |
1.5.9