CategoryCollection
class CategoryCollection extends Collection
Constants
SORT_ALPHABETICAL |
|
SORT_NUMERICAL |
|
EVENT_AFTER_LOAD |
|
Properties
protected Model | $model | reference to model-type |
from ModelCollection |
protected bool|Model[] | $models | Array of models in this collection |
from ModelCollection |
protected bool | $loaded | Boolean which indicates whether collection is loaded or not (not equal empty!) |
from ModelCollection |
EventplannerController | $mod |
Methods
Create new Model Array
returns model found by property => value
Apply lib->format multi_format on passed property. The result will be written to ->[property]_formatted
No description
Set property values to models from array
Runs the passed function batched for the passed amount of models to reduce memory issues while creating too many model objects at once This function should be called on an unloaded Collection to be most effective
Returns the number of containing models Attention: This will load all models of the collection Use $model_collection->count_all() for this case to determine count without loading all models Note: this function is called if the php function count(this_collection) is used
Creates a delete statement for the scoped collection and executes it.
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
Prefetch and returns document index objects for all items of this collection.
No description
No description
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
Returns the passed property of all objects in an array
Returns the passed property of all objects in an array (unique and filtered)
this function returns the last value of the models-array, shortening the models-array by one element.
this function treats models-array as a stack, and pushes the passed variables onto the end of array.
If the collection is not loaded yes the collection will use all() to be filled
Resets the loaded collection by clearing all loaded models and marking the collection as not being loaded.
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
No description
This function shifts the first value of the models-array off and returns it, shortening the array by one element and moving everything down.
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
Sorts the current Collection by given Property-Name
Returns the sum of the passed property across all models
Returns collection as array of models
Returns an XML of all model properties
This function prepends passed elements to the front of the array.
Creates an update statement for the scoped collection and executes it.
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
Details
in
ModelCollection at line 171
mixed
__call(mixed $method, mixed $args = array())
Handle find functions
in
ModelCollection at line 82
__construct(Model $model, array|ModelCollection|bool $model_array = null, $useModelClone = true)
Create new Model Array
in
ModelCollection at line 808
__toString()
No description
in
ModelCollection at line 518
protected Model|ModelCollection|bool
_search_by(string $query, array|bool $parameters = false, bool $return_single = true)
returns model found by property => value
in
Collection at line 48
int|int[]
addAfterLoadListener(callable $function)
No description
in
ModelCollection at line 795
add_formatted_property(string $property, string $format, array $options = array())
Apply lib->format multi_format on passed property. The result will be written to ->[property]_formatted
at line 17
self
all(mixed $args))
No description
in
ModelCollection at line 890
append(mixed $value)
Adds an Object to the models-array.
It will be appended after the last position of array
in
Collection at line 15
void
array() $int, T> $etIterator()
No description
in
ModelCollection at line 483
attach(string $property, array $values, string $key_field = null)
Set property values to models from array
in
ModelCollection at line 357
batchProcess(int $batchSize, callable $callback)
Runs the passed function batched for the passed amount of models to reduce memory issues while creating too many model objects at once This function should be called on an unloaded Collection to be most effective
in
ModelCollection at line 869
int
count()
Returns the number of containing models Attention: This will load all models of the collection Use $model_collection->count_all() for this case to determine count without loading all models Note: this function is called if the php function count(this_collection) is used
in
ModelCollection at line 22
int
count_all()
No description
at line 17
static CategoryCollection
create(Category $model)
No description
in
ModelCollection at line 1207
array
debug()
Use for debugging
in
Collection at line 94
mixed
delete()
Creates a delete statement for the scoped collection and executes it.
When there's no scope defined, throws a LogicException to prevent an accidental delete of the whole table.
in
ModelCollection at line 1041
void
filter(mixed $callback = false)
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
Iterates over each value in the models-array passing them to the callback function. If the callback function returns true, the current value from input is returned into the result array. Array keys are preserved.
in
ModelCollection at line 150
ModelCollection
getDocumentIndexes()
Prefetch and returns document index objects for all items of this collection.
at line 17
Category[]
getIterator()
No description
in
ModelCollection at line 1195
array|bool
get_db_properties()
No description
in
ModelCollection at line 1188
Model
get_model()
Returns the Default-Model (-Type) for this Collection
in
ModelCollection at line 113
string
get_model_class()
put your comment there.
..
in
ModelCollection at line 121
array|Model[]
get_models()
Returns array with objects
at line 19
init()
No description
in
ModelCollection at line 336
array
invoke(string $method)
internal | param mixed $args Additional Parameters |
Calls the passed method for each object
in
ModelCollection at line 129
bool
is_loaded()
Returns true if this collection has been filled
in
ModelCollection at line 1093
Model|bool
last()
Return the last element of the collection
in
ModelCollection at line 942
void
merge()
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
Merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array. If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended. If only one array is given and the array is numerically indexed, the keys get reindexed in a continuous way.
in
ModelCollection at line 1243
bool
offsetExists(mixed $offset)
isset($collection[0])
at line 17
Category
offsetGet(mixed $offset)
No description
in
ModelCollection at line 1230
offsetSet(mixed $offset, mixed $value)
$collections[0] = $entry
in
ModelCollection at line 1254
offsetUnset(mixed $offset)
unset($collection[0])
in
ModelCollection at line 416
pluck(string|string[] $property, string $key_field = null)
Returns the passed property of all objects in an array
in
ModelCollection at line 465
array
pluck_unique(mixed $property, mixed $key_field = false)
Returns the passed property of all objects in an array (unique and filtered)
in
ModelCollection at line 903
Model|null
pop()
this function returns the last value of the models-array, shortening the models-array by one element.
Will additionally produce a Warning when called on a non-array.
in
ModelCollection at line 917
int
push(Model $model1, Model $model2 = null)
this function treats models-array as a stack, and pushes the passed variables onto the end of array.
The length of array increases by the number of variables pushed.
in
ModelCollection at line 137
bool
require_loading()
If the collection is not loaded yes the collection will use all() to be filled
in
ModelCollection at line 1059
reset()
Resets the loaded collection by clearing all loaded models and marking the collection as not being loaded.
Will not reset scope.
in
ModelCollection at line 1003
reverse(bool $preserve_keys = false)
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
The models-array will be modified with the order of the elements reversed.
in
ModelCollection at line 302
ModelCollection
save(bool $silent = false)
No description
in
ModelCollection at line 22
ModelCollection
scope_by_COL(mixed $value)
No description
in
ModelCollection at line 22
Model[]
search_all_by_id(mixed $id, mixed $query_params)
No description
at line 17
self
search_all_by_pid(int $pid)
No description
in
ModelCollection at line 22
Model
search_by_id(mixed $id, mixed $query_params)
No description
in
ModelCollection at line 284
ModelCollection
setProperty(string $key, mixed $value)
No description
in
ModelCollection at line 969
Model|null
shift()
This function shifts the first value of the models-array off and returns it, shortening the array by one element and moving everything down.
All numerical array keys will be modified to start counting from zero while literal keys won't be touched.
in
ModelCollection at line 1084
slice(int $offset, int|bool $length = false, bool $preserve_keys = false)
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
in
ModelCollection at line 1120
ModelCollection
sort_by(string $property, string $order_by = 'asc', int $type = ModelCollection::SORT_ALPHABETICAL)
Sorts the current Collection by given Property-Name
in
ModelCollection at line 393
mixed
sum(string $property, string|bool $group_field = false)
Returns the sum of the passed property across all models
in
ModelCollection at line 819
array|Model[]
to_array(bool $raw = false)
Returns collection as array of models
in
ModelCollection at line 836
string
to_json()
Returns collection as json of models
in
ModelCollection at line 804
string
to_string()
Returns collection as string
in
ModelCollection at line 846
string
to_xml(array|bool $property_filter = false)
Returns an XML of all model properties
in
ModelCollection at line 982
int
unshift()
This function prepends passed elements to the front of the array.
Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won't be touched.
in
ModelCollection at line 319
ModelCollection
updateDocumentIndexes()
No description
in
Collection at line 66
mixed
updateField(string $field, string|int|float $value)
Creates an update statement for the scoped collection and executes it.
When there's no scope defined, throws a LogicException to prevent an accidental update of the whole table.
in
ModelCollection at line 1025
bool
usort(mixed $cmp_function)
DESTRUCTIVE This will manipulate the models-list and doesn't return anything!
This function will sort the models-array by its values using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function.