2require_once(dirname(__FILE__) .
'/../class.ActiveRecord.php');
25 public static function getInstance(&$model)
33 $method =
self::_toCamelCase(
'get_' . $storage->getArFieldList()->getPrimaryFieldName());
34 $storage->setExternalModelForStorage($model);
35 $storage->{$storage->getArFieldList()->getPrimaryFieldName()} = $model->{$method}();
36 if ($storage->{$storage->getArFieldList()->getPrimaryFieldName()}) {
39 $storage->mapFromActiveRecord();
47 $this->mapToActiveRecord();
54 $this->mapToActiveRecord();
62 $this->mapFromActiveRecord();
68 foreach (array_keys($this->getArFieldList()->getArrayForConnector()) as
$key) {
69 $this->{$key} = $this->getValueForStorage(
$key);
76 foreach (array_keys($this->getArFieldList()->getArrayForConnector()) as
$key) {
77 $this->setValueToModel(
$key, $this->{$key});
89 $method = self::_toCamelCase(
'get_' .
$key);
91 return $this->getExternalModelForStorage()->{$method}();
103 $method = self::_toCamelCase(
'set_' .
$key);
105 return $this->getExternalModelForStorage()->{$method}($value);
120 $this->external_model_for_storage = $model;
129 return $this->external_model_for_storage;
static _toCamelCase($str, $capitalise_first_char=false)
An exception for terminatinating execution or to throw for unit testing.
static storeFromStorage($storage_class_name, arStorageInterface $foreign_model)
setExternalModelForStorage($model)
getExternalModelForStorage()
$external_model_for_storage
setValueToModel($key, $value)
update($pash, $contents, Config $config)