[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_scheduler/src/Model/ -> TaskModel.php (summary)

(no description)

Copyright: (C) 2021 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 797 lines (27 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TaskModel:: (15 methods):
  __construct()
  getForm()
  canDelete()
  populateState()
  getTable()
  loadFormData()
  getItem()
  getTask()
  configureTaskGetterOptions()
  save()
  processExecutionRules()
  buildExecutionRules()
  unlock()
  wildcardIfMatch()
  preprocessForm()


Class: TaskModel  - X-Ref

MVC Model to interact with the Scheduler DB.
Implements methods to add, remove, edit tasks.

__construct($config = array()   X-Ref
TaskModel constructor. Needed just to set $app

param: array                      $config       An array of configuration options
param: MVCFactoryInterface|null   $factory      The factory
param: FormFactoryInterface|null  $formFactory  The form factory

getForm($data = array()   X-Ref
Fetches the form object associated with this model. By default,
loads the corresponding data from the DB and binds it with the form.

param: array  $data      Data that needs to go into the form
param: bool   $loadData  Should the form load its data from the DB?
return: Form|boolean  A JForm object on success, false on failure.

canDelete($record)   X-Ref
Determine whether a record may be deleted taking into consideration
the user's permissions over the record.

param: object  $record  The database row/record in question
return: boolean  True if the record may be deleted

populateState()   X-Ref
Populate the model state, we use these instead of toying with input or the global state

return: void

getTable($name = 'Task', $prefix = 'Table', $options = array()   X-Ref
Don't need to define this method since the parent getTable()
implicitly deduces $name and $prefix anyways. This makes the object
more transparent though.

param: string  $name     Name of the table
param: string  $prefix   Class prefix
param: array   $options  Model config array
return: Table

loadFormData()   X-Ref
Fetches the data to be injected into the form

return: object  Associative array of form data.

getItem($pk = null)   X-Ref
Overloads the parent getItem() method.

param: integer  $pk  Primary key
return: object|boolean  Object on success, false on failure

getTask(array $options = [])   X-Ref
Get a task from the database, only if an exclusive "lock" on the task can be acquired.
The method supports options to customise the limitations on the fetch.

param: array  $options  Array with options to fetch the task:
return: ?\stdClass  Task entry as in the database.

configureTaskGetterOptions(OptionsResolver $resolver)   X-Ref
No description

save($data)   X-Ref

param: array  $data  The form data
return: boolean  True on success, false on failure

processExecutionRules(array $unprocessedRules)   X-Ref
Clean up and standardise execution rules

param: array  $unprocessedRules  The form data [? can just replace with execution_interval]
return: array  Processed rules

buildExecutionRules(array $executionRules)   X-Ref
Private method to build execution expression from input execution rules.
This expression is used internally to determine execution times/conditions.

param: array  $executionRules  Execution rules from the Task form, post-processing.
return: array

unlock(array &$pks)   X-Ref
This method releases "locks" on a set of tasks from the database.
These locks are pseudo-locks that are used to keep a track of running tasks. However, they require require manual
intervention to release these locks in cases such as when a task process crashes, leaving the task "locked".

param: array  $pks  A list of the primary keys to unlock.
return: boolean  True on success.

wildcardIfMatch(array $target, array $reference, bool $targetToInt = false)   X-Ref
Determine if an array is populated by all its possible values by comparison to a reference array, if found a
match a wildcard '*' is returned.

param: array  $target       The target array
param: array  $reference    The reference array, populated by the complete set of possible values in $target
param: bool   $targetToInt  If true, converts $target array values to integers before comparing
return: string  A wildcard string if $target is fully populated, else $target itself.

preprocessForm(Form $form, $data, $group = 'content')   X-Ref
No description



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer