.

CreateCommand Class Reference
[Behaviour]

Generic create command. More...

Inheritance diagram for CreateCommand:
CommandTransactional CommandBase ICommand IAction ISerializable

List of all members.

Public Member Functions

  get_description ()
  Returns a description of this command.
  get_name ()
  Returns title of command.

Protected Member Functions

  do_execute ()
  Executes commands.

Detailed Description

Generic create command.

Author:
Gerd Riesselmann

Definition at line 8 of file create.cmd.php.


Member Function Documentation

CreateCommand::do_execute (  )  [protected]

Executes commands.

Returns:
Status

Reimplemented from CommandTransactional.

Definition at line 14 of file create.cmd.php.

00014                                         {
00015                 $ret = new Status();
00016                 $inst = DB::create($this->get_instance());
00017                 if ($inst) {
00018                         $inst->set_default_values();
00019                         $inst->read_from_array($this->get_params());
00020                         $ret->merge($inst->validate());
00021                         if ($ret->is_ok()) {
00022                                 $ret->merge($inst->insert());
00023                                 $this->set_result($inst);               
00024                         }
00025                 }
00026                 else {
00027                         $ret->append(tr('Unknown model %s', 'core', array('%s' => $this->get_instance())));
00028                 }
00029                 
00030                 return $ret;
00031         }
CreateCommand::get_description (  ) 

Returns a description of this command.

Reimplemented from CommandBase.

Definition at line 43 of file create.cmd.php.

00043                                           {
00044                 $ret = '';
00045                 $ret = tr(
00046                         'Create new %type',
00047                         'app',
00048                         array('%type' => $this->get_instance())
00049                 );
00050                 return $ret;
00051         }
CreateCommand::get_name (  ) 

Returns title of command.

Reimplemented from CommandBase.

Definition at line 36 of file create.cmd.php.

00036                                    {
00037                 return 'create';
00038         }

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