\midcom_services_at_cron_check

The Cron handler of the AT service, when executed it checks the database for entries that need to be run, then loads their relevant components and calls the interface class for the defined method.

It gives you an easy to use way of building cron jobs. You should rely only on the two event handlers _on_initialize and execute, which are called by the cron service.

See the main cron service class for details.

Summary

Methods
Properties
Constants
initialize()
_on_initialize()
execute()
print_error()
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
$_component
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
No protected properties found
N/A
process_entry()
handle_error()
$_services
N/A

Properties

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

initialize()

initialize(array  $config) 

Initialize the cron job. Before calling the on_initialize callback, it prepares the instance with various configuration variables

Parameters

array $config

The full cron job configuration data.

_on_initialize()

_on_initialize() : boolean

This callback is executed immediately after object construction. You can initialize your class here.

If you return false here, the handler is not executed, the system skips it.

All class members are already initialized when this event handler is called.

Returns

boolean —

Returns true, if initialization was successful, false if anything went wrong.

execute()

execute() 

Loads all entries that need to be processed and processes them.

You should use the print_error() helper of this class in case you need to notify the user of any errors. As long as everything goes fine, you should not print anything to avoid needless cron mailings.

print_error()

print_error(string  $message, mixed  $var = null) 

Echo the error message to the client, automatically appending the classname to the prefix. Passed messages are also written to the error log.

Parameters

string $message

The error message to print.

mixed $var

A variable you want to print, if any.

__construct()

__construct() 

Initialize all member variables, remember to set $_component before calling this constructor from your derived classes.

__get()

__get(  $field) 

Parameters

$field

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

handle_error()

handle_error(\midcom_services_at_entry_dba  $entry,   $error, array  $args) 

Parameters

\midcom_services_at_entry_dba $entry
$error
array $args