Class Adapter

Description

Base Class for Business Object Adapters

This class can be used to treat older business objects like phool models with a defined interface. Thus you can successively adapt your old business objects and "translate" them step by step into new models.

Only the abstract methods defined by the parent class "Model" must be implemented by the new Class right from the start. These are load(), save() and remove(). The abstract method "adapt()", that must be implemented to create and set up the adaptee object.

  • see: Model
  • todo: rename to LegacyAdapter
  • todo: create DbAdapter
  • todo: create FileAdapter
  • abstract:

Located in /adapter.php (line 27)

Model
   |
   --Adapter
Variable Summary
mixed $adaptee
Method Summary
Adapter Adapter ([ $data = array( )])
void adapt ()
boolean load ( $id)
boolean remove ()
int save ()
void set ( $k,  $v)
void set_all ( $data)
void __call (string $method, array $args)
Variables
mixed $adaptee (line 33)

The original business object to be adapted

  • access: protected
Methods
Constructor Adapter (line 35)
Adapter Adapter ([ $data = array( )])
  • $data
adapt (line 52)

Abstract method adapt must be implemented by subclass

Create the adapted business object and perform any setup code needed to make the adaptee work.

  • abstract:
  • access: protected
void adapt ()
load (line 59)

Implements READ for adapted Model

  • return: success
boolean load ( $id)
  • $id
remove (line 85)

Implements DELETE for adapted Model

  • return: success
boolean remove ()
save (line 72)

Implements CREATE and UPDATE for adapted Model

  • return: model id
int save ()
set (line 97)

Value Object Manipulators

void set ( $k,  $v)
  • $k
  • $v
set_all (line 103)
void set_all ( $data)
  • $data
__call (line 121)

Magic function for adaptee passthrough

If a method is called which isn't yet implemented in the adapter, the call will be passed to the adaptee.

void __call (string $method, array $args)
  • string $method: method name
  • array $args: method params

Documentation generated on Tue, 12 May 2009 23:09:35 +0200 by phpDocumentor 1.4.1