|
Stud.IP
2.4 Revision 48548
|


Public Member Functions | |
| __construct ($id=null) | |
| __clone () | |
| getRelationOptions ($relation) | |
| getTableMetadata () | |
| hasAutoIncrementColumn () | |
| setId ($id) | |
| getId () | |
| getNewId () | |
| toArray ($only_these_fields=null) | |
| toArrayRecursive ($depth=1, $only_these_fields=null) | |
| getValue ($field) | |
| getRelationValue ($relation, $field) | |
| setValue ($field, $value) | |
| __get ($field) | |
| __set ($field, $value) | |
| __isset ($field) | |
| offsetExists ($offset) | |
| offsetGet ($offset) | |
| offsetSet ($offset, $value) | |
| offsetUnset ($offset) | |
| getIterator () | |
| count () | |
| isField ($field) | |
| isAdditionalField ($field) | |
| isAliasField ($field) | |
| setData ($data, $reset=false) | |
| haveData () | |
| isNew () | |
| isDeleted () | |
| setNew ($is_new) | |
| getWhereQuery () | |
| restore () | |
| store () | |
| triggerChdate () | |
| delete () | |
| isDirty () | |
| isFieldDirty ($field) | |
| revertValue ($field) | |
| initRelation ($relation) | |
| resetRelation ($relation) | |
Static Public Member Functions | |
| static | expireTableScheme () |
| static | find ($id) |
| static | exists ($id) |
| static | countBySql ($where=1, $params=array()) |
| static | create ($data) |
| static | import ($data) |
| static | findBySQL ($where, $params=array()) |
| static | findThru ($foreign_key_value, $options) |
| static | findEachBySQL ($callable, $where, $params=array()) |
| static | findMany ($pks=array(), $order= '') |
| static | findEachMany ($callable, $pks=array(), $order= '') |
| static | deleteBySQL ($where, $params=array()) |
| static | toObject ($id_or_object) |
| static | __callStatic ($name, $arguments) |
Protected Member Functions | |
| parseRelationOptions ($type, $name, $options) | |
| getTableScheme () | |
| storeRelations () | |
| deleteRelations () | |
| initializeContent () | |
| applyCallbacks ($type) | |
| registerCallback ($types, $cb) | |
| unregisterCallback ($types, $cb) | |
| cbAutoIncrementColumn ($type) | |
| cbAutoKeyCreation () | |
Static Protected Member Functions | |
| static | tableScheme ($db_table) |
Protected Attributes | |
| $content = array() | |
| $content_db = array() | |
| $is_new = true | |
| $db_table = '' | |
| $db_fields = null | |
| $pk = null | |
| $default_values = array() | |
| $alias_fields = array() | |
| $additional_fields = array() | |
| $relations = array() | |
| $has_many = array() | |
| $has_one = array() | |
| $belongs_to = array() | |
| $has_and_belongs_to_many = array() | |
| $registered_callbacks | |
| $known_slots = array() | |
| $reserved_slots = array('value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id') | |
Static Protected Attributes | |
| static | $schemes |
| __construct | ( | $id = null | ) |
constructor, give primary key of record as param to fetch corresponding record from db if available, if not preset primary key with given value. Give null to create new record
| mixed | $id | primary key of table |
Reimplemented in PersonalNotifications, StudipNews, WebserviceAccessRule, Semester, Institute, LockRule, CronjobSchedule, SemesterHoliday, Banner, DatafieldEntryModel, RoomRequest, StudipComment, StudipDocument, User, StudipScmEntry, StudipAdmissionGroup, SeminarCycleDate, Kategorie, CronjobLog, UserConfigEntry, StudipStudyArea, AdmissionApplication, ConfigEntry, ArchivedCourseMember, CourseMember, InstituteMember, AuthUserMd5, UserInfo, ArchivedCourse, Course, Datafield, NewsRange, and CronjobTask.
|
static |
interceptor for static findByColumn / findEachByColumn magic
| string | $name | |
| array | $arguments |
| BadMethodCallException |
| __clone | ( | ) |
clean up references after cloning
| __get | ( | $field | ) |
magic method for dynamic properties
| __isset | ( | $field | ) |
magic method for dynamic properties
| __set | ( | $field, | |
| $value | |||
| ) |
magic method for dynamic properties
|
protected |
invoke registered callbacks for given type if one callback returns false the following will not be invoked
| string | $type | type of callback |
|
protected |
default callback for tables with auto_increment primary key
| string | $type | callback type |

|
protected |
default callback for tables without auto_increment
| count | ( | ) |
|
static |
returns number of records
| string | sql clause to use on the right side of WHERE |
| array | params for query |


|
static |
creates new record with given data in db returns the new object or null
| array | assoc array of record |
| delete | ( | ) |
delete entry from database the object is cleared, but is not(!) turned to new state
Reimplemented in RoomRequest, StudipStmInstance, StudipNews, StudipAdmissionGroup, LockRule, SeminarCycleDate, Banner, and StudipDocument.

|
static |
deletes table rows specified by given class and sql clause
| string | sql clause to use on the right side of WHERE |
| array | parameters for query |


|
protected |
sends a delete message to all related objects if a relation has a callback for 'on_delete' configured, the callback is invoked instead

|
static |
returns true if given key exists in db
| string | primary key |

|
static |
force reload of cached table metadata

|
static |
returns new instance for given key when found in db, else null
| string | primary key |
Reimplemented in StudipStudyArea, Semester, and SemesterHoliday.

|
static |
returns array of instances of given class filtered by given sql
| string | sql clause to use on the right side of WHERE |
| array | parameters for query |


|
static |
passes objects for given sql through given callback and returns an array of callback return values
| callable | $callable | callback which gets the current record as param |
| string | where clause of sql | |
| array | sql statement parameters |

|
static |
passes objects for by given pks through given callback and returns an array of callback return values
| callable | $callable | callback which gets the current record as param |
| array | $pks | array of primary keys of called class |
| string | $order | order by sql |

|
static |
returns array of instances of given class for by given pks
| array | array og primary keys |
| string | order by clause |


|
static |
find related records for a n:m relation (has_many_and_belongs_to_many) using a combination table holding the keys
| string | value of foreign key to find related records |
| array | relation options from other side of relation |

| getId | ( | ) |
returns primary key, multiple keys as array

| getIterator | ( | ) |
| getNewId | ( | ) |
create new unique pk as md5 hash if pk consists of multiple columns, false is returned


| getRelationOptions | ( | $relation | ) |
returns array with option for given relation available options: 'type': relation type, on of 'has_many', 'belongs_to', 'has_one', 'has_and_belongs_to_many' 'class_name': name of class for related records 'foreign_key': name of column with foreign key or callback to retrieve foreign key value 'assoc_foreign_key': name of foreign key column in related class 'assoc_func': name of static method to call on related class to find related records 'assoc_func_params_func': callback to retrieve params for assoc_func 'thru_table': name of relation table for n:m relation 'thru_key': name of column holding foreign key in relation table 'thru_assoc_key': name of column holding foreign key from related class in relation table 'on_delete': contains simply 'delete' to indicate that related records should be deleted or callback to invoke before record gets deleted 'on_store': contains simply 'store' to indicate that related records should be stored or callback to invoke after record gets stored
| string | $relation | name of relation |
| getRelationValue | ( | $relation, | |
| $field | |||
| ) |
gets a value from a related object only possible, if the relation has cardinality 1 e.g. 'has_one' or 'belongs_to'
| string | $relation | name of relation |
| string | $field | name of column |
| InvalidArgumentException | if no relation with given name is found |
| getTableMetadata | ( | ) |
returns table metadata
|
protected |
restore table metadata from db or cache
| getValue | ( | $field | ) |
returns value of a column
| InvalidArgumentException | if column could not be found |
| BadMethodCallException | if getter for additional field could not be found |
| string | $field |
Reimplemented in StudipStmInstance, StudipAdmissionGroup, StudipStmInstanceElement, and CronjobTask.

| getWhereQuery | ( | ) |
returns sql clause with current table and pk


| hasAutoIncrementColumn | ( | ) |
returns true, if table has an auto_increment column
| haveData | ( | ) |
check if object is empty
|
static |
generate SimpleORMap object structure from assoc array if given array contains data of related objects in sub-arrays they are also generated. Existing records are updated, new records are created (but changes are not yet stored)
| array | $data |

|
protected |
init internal content arrays with nulls
| UnexpectedValueException | if there is an unmatched alias |
| initRelation | ( | $relation | ) |
intitalize a relationship and get related record(s)
| string | $relation | name of relation |
| InvalidArgumentException | if the relation does not exists |
| isAdditionalField | ( | $field | ) |
check if given column is additional
| string | $field |
| isAliasField | ( | $field | ) |
check if given column is an alias
| string | $field |
| isDeleted | ( | ) |
check if object was deleted
| isDirty | ( | ) |
checks if at least one field was modified since last restore

| isField | ( | $field | ) |
check if given column exists in table
| string | $field |
| isFieldDirty | ( | $field | ) |
checks if given field was modified since last restore
| string | $field |

| isNew | ( | ) |
check if object exists in database

| offsetExists | ( | $offset | ) |
ArrayAccess: Check whether the given offset exists.
| offsetGet | ( | $offset | ) |
ArrayAccess: Get the value at the given offset.
| offsetSet | ( | $offset, | |
| $value | |||
| ) |
ArrayAccess: Set the value at the given offset.
| offsetUnset | ( | $offset | ) |
ArrayAccess: unset the value at the given offset (not applicable)
|
protected |
try to determine all needed options for a relationship from configured options
| string | $type | |
| string | $name | |
| array | $options |
| Exception | if options for thru_table could not be determined |
|
protected |
register given callback for one or many possible callback types callback param could be a closure or method name of current class
| string | array | $types | types to register callback for |
| mixed | $cb | callback |
| InvalidArgumentException | if the callback type is not known |


| resetRelation | ( | $relation | ) |
clear data for a relationship
| string | $relation | name of relation |
| InvalidArgumentException | if teh relation does not exists |

| restore | ( | ) |
restore entry from database
Reimplemented in RoomRequest, StudipStmInstance, StudipStmInstanceElement, and StudipAdmissionGroup.

| revertValue | ( | $field | ) |
reverts value of given field to last restored value
| string | $field |
| setData | ( | $data, | |
$reset = false |
|||
| ) |
set multiple column values if second param is set, existing data in object will be discarded and dirty state is cleared, else new data overrides old data
| array | $data | assoc array |
| boolean | $reset | existing data in object will be discarded |
Reimplemented in StudipAdmissionGroup, and LockRule.
| setId | ( | $id | ) |
set primary key for entry, combined keys must be passed as array
| string|array | primary key |
| InvalidArgumentException | if given key is not complete |

| setNew | ( | $is_new | ) |
set object to new state
| boolean | $is_new |

| setValue | ( | $field, | |
| $value | |||
| ) |
sets value of a column
| InvalidArgumentException | if column could not be found |
| BadMethodCallException | if setter for additional field could not be found |
| string | $field | |
| string | $value |

| store | ( | ) |
store entry in database
| UnexpectedValueException | if there are forbidden NULL values |
Reimplemented in RoomRequest, StudipStmInstance, User, CronjobSchedule, LockRule, and StudipAdmissionGroup.


|
protected |
sends a store message to all initialized related objects if a relation has a callback for 'on_store' configured, the callback is instead invoked


|
staticprotected |
fetch table metadata from db or from local cache
| string | $db_table |

| toArray | ( | $only_these_fields = null | ) |
returns data of table row as assoc array pass array of fieldnames or ws separated string to limit fields
| mixed | $only_these_fields | limit returned fields |


| toArrayRecursive | ( | $depth = 1, |
|
$only_these_fields = null |
|||
| ) |
returns data of table row as assoc array including all related records with a 'has*' relationship
| $depth | set to > 1 if related objects schuld also call their related records | |
| mixed | $only_these_fields | limit returned fields |
Reimplemented in User.
|
static |
returns object of given class for given id or null the param could be a string, an assoc array containing primary key field or an already matching object. In all these cases an object is returned
| mixed | id as string, object or assoc array |

| triggerChdate | ( | ) |
set chdate column to current timestamp
Reimplemented in User.


|
protected |
unregister given callback for one or many possible callback types
| string | array | $types | types to unregister callback for |
| mixed | $cb |
| InvalidArgumentException | if the callback type is not known |

|
protected |
additional computed fields name => callable
|
protected |
aliases for columns alias => column
|
protected |
n:1 relations
|
protected |
table row data
|
protected |
table row data
|
protected |
table columns
|
protected |
name of db table
|
protected |
default values for columns
|
protected |
n:m relations
|
protected |
1:n relation
|
protected |
1:1 relation
|
protected |
new state of entry
|
protected |
contains an array of all used identifiers for fields (db columns + aliased columns + additional columns + relations)
|
protected |
primary key columns
|
protected |
callbacks
|
protected |
stores instantiated related objects
|
protected |
reserved indentifiers, fields with those names must not have an explicit getXXX() method
|
staticprotected |
db table metadata