public function __clone() { $this->cachedId = null; $this->originalRecord = self::getInstanceByID(get_class($this), $this->getID()); foreach ($this->data as $key => $valueMapper) { $this->data[$key] = clone $valueMapper; $this->{$key} = $this->data[$key]; } foreach ($this->schema->getForeignKeyList() as $name => $field) { $referenceName = $field->getReferenceFieldName(); $referenceName = strtolower(substr($referenceName, 0, 1)) . substr($referenceName, 1); $this->{$referenceName} = $this->data[$name]; } $this->resetID(); }
public static function transformArray($array, ARSchema $schema) { unset($array[call_user_func(array($schema->getName(), 'getOwnerClass'))]); unset($array[call_user_func(array($schema->getName(), 'getFieldClass'))]); return MultiLingualObject::transformArray($array, $schema); }
protected static function transformArray($array, ARSchema $schema) { $schemaName = $schema->getName(); foreach ($schema->getFieldsByType('ARDateTime') as $name => $field) { if (isset($array[$name])) { $time = strtotime($array[$name]); if (!$time) { continue; } if (!isset($locale)) { $locale = self::getApplication()->getLocale(); } $array['formatted_' . $name] = $locale->getFormattedTime($time); } } $data = parent::transformArray($array, $schema); $data['__class__'] = $schemaName; if (self::isEav($schemaName)) { self::addToEavQueue($schemaName, $data); } try { self::executePlugins($data, 'array', $schemaName); } catch (Exception $e) { die($e->getMessage() . ' (' . __LINE__); } return $data; }