->set*() and ->get*()

->set*() and ->get*() -- Automatic Setters and Getters using overload

Synopsis

true | string $DB_DataObject->set* (mixed $value)

mixed $DB_DataObject->get* ()

Описание

From version PHP 4.3.2RC2 onwards, DB_DataObject is automatically overloaded, providing access to all variables using $object->set{ColumnName}() and $object->set{ColumnName}($value) even if you have not defined the method.

It is assumed that set methods return strings as errors or TRUE, so that it can interact with setFrom and return array's of error strings.

The get Methods are used by toArray(), if defined they can be used to alter the appearance of columns ,like making dates human readable

The logic is very simple, if you call $object->setXXX() and it is not defined, it will just set the value, if you define a method setXXXX, that will be called instead of the default handler, same applies to getXXX().

Due to the naming conflict possiblity of a column named from, the associated method for column 'from' is set_from, rather than setFrom()

Параметр

Возвращаемое значение

mixed - setters will return TRUE from the default method, in your implementations of setters. It is expected that setXXX($value) will return a string (the error) if it is invalid or TRUE on success. getXXX may return the value or a formated value, remember though it affects $object->toArray().

Заметка

Эта функция не должна вызываться статически.

Warning: This is experimental, its behavour may change slightly in the future.

Пример


HIVE: All information for read only. Please respect copyright!
Hosted by hive йца: йХЕБЯЙЮЪ ЦНПНДЯЙЮЪ АХАКХНРЕЙЮ