.

CommandsFactory Class Reference
[Behaviour]

The commands factory instanciates commands, following the rules for overloading commands. More...

List of all members.

Static Public Member Functions

static  create_command ($obj, $cmd_name, $params)
  Return the strategy to change status of given object to $new_status.

Detailed Description

The commands factory instanciates commands, following the rules for overloading commands.

Commands are overloaded by placing correctly named class files in according directories.

Files are loaded form the following directories in the order given below

1.) app/behaviour/commands/[type] 2.) [modules]/behaviour/commands/[type] 3.) [core]/behaviour/commands/[type] 4.) app/behaviour/commands/generics 5.) [modules]/behaviour/commands/generics 6.) [core]/behaviour/commands/generics

Author:
Gerd Riesselmann

Definition at line 19 of file commands.factory.php.


Member Function Documentation

static CommandsFactory::create_command ( obj,
cmd_name,
params  
) [static]

Return the strategy to change status of given object to $new_status.

Returns:
ICommand Returns the command or FALSE, if no command was found

Definition at line 25 of file commands.factory.php.

00025                                                                         {
00026                 $inst_name = self::get_instance_name($obj);
00027                 
00028                 $key = 'cmdfac#' . $inst_name . '#' . $cmd_name;
00029                 $cls = RuntimeCache::get($key, null);           
00030                 if (is_null($cls)) {
00031                         $cls = self::get_command_class($inst_name, $cmd_name);
00032                         RuntimeCache::set($key, $cls);
00033                 }
00034                 
00035                 if ($cls) {
00036                         return new $cls($obj, $params);
00037                 }
00038                 
00039                 return false;
00040         }

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