.

StatusCommand Class Reference
[Status]

Command to set status. More...

Inheritance diagram for StatusCommand:
CommandDelegate ICommand IAction ISerializable

List of all members.

Public Member Functions

  __construct ($obj, $params)
  Constructor.

Detailed Description

Command to set status.

Expects new status as param.

Creates delegate, a command named Status[Newstatus][Object]Command, located in a file named status.[newstatus].cmd.php.

If no such command is found, it falls back to

If an application or module provides an overload, the command should be derived from the generic StatusAnyCommand.

Example: Given a model users that has states UNCONFIRMED and ACTIVE and you want to do something special, if status becomes ACTIVE. Create a class StatusActiveUsersCommand in file behaviour/commands/users/status.active.cmd.php, derive it from generic StatusAnyCommand and overload do_execute().

Author:
Gerd Riesselmann

Definition at line 26 of file status.cmd.php.


Constructor & Destructor Documentation

StatusCommand::__construct ( obj,
params  
)

Constructor.

Parameters:
unknown_type  $obj
unknown_type  $params

Definition at line 33 of file status.cmd.php.

00033                                                    {
00034                 $params = Arr::force($params);
00035                 $new_status = String::to_lower(Arr::get_item($params, 0, ''));
00036                 if ($new_status == '') {
00037                         throw new Exception(tr('Status command called with empty status', 'status'));
00038                         exit;
00039                 }
00040                 $action = 'status.' . $new_status;
00041                 $delegate = CommandsFactory::create_command($obj, $action, $params);
00042                 if (empty($delegate)) {
00043                         $delegate = CommandsFactory::create_command($obj, 'status.any', $params);                       
00044                 }
00045                 parent::__construct($delegate);
00046         }

The documentation for this class was generated from the following file: