EASC and enums

at 2009-01-28 in EASC by friebe (0 comments)

Quite a while ago, we showed a workaround on how to work with enum types and the Remote API. A bit later, there was RFC #0132 which added real enum types to the XP Framework, but support for them in EASC was forgotten. This oversight has now been resolved.



The workaround
  class Provider extends Object {
public
$name= '';
public
function __construct($name= '') {
$this->name= $name;
}
}

// ...
$caseId= $facade->createCase($faxId, new Provider('FAX'), $url);

New usage
  class Provider extends Enum {
public
static $FAX;

static function __static() {
self::
$FAX= new self(0, 'FAX');
}

public
static function values() {
return parent::membersOf
(__CLASS__);
}
}

// ...
$caseId= $facade->createCase($faxId, Provider::$FAX, $url);



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES
Unicode
Language
5.9-SERIES

Related

Find related articles by a search for «EASC».