public function current() { $record = parent::current(); $user = new User(); foreach ($record as $key => $value) { $user->{$key} = $value; } return $user; }
public function current() { $record = parent::current(); $role = new Role(); $role->id = $record->id; $role->name = $record->name; $role->description = $record->description; // Load Permissions $permissions = Symphony::Database()->query("SELECT * FROM `tbl_uac_permissions` WHERE `role_id` = %d", array($role->id)); if ($permissions->length() > 0) { foreach ($permissions as $p) { $role->permissions()->{"{$p->key}.{$p->type}"} = $p->level; } } // Load Forbidden Pages return $role; }
public function current() { $record = parent::current(); $entry = new Entry(); foreach ($record as $key => $value) { $entry->{$key} = $value; } // Load the section try { $section = Section::loadFromHandle($entry->section); } catch (SectionException $e) { throw new EntryException('Section specified, "' . $entry->section . '", in Entry object is invalid.'); } catch (Exception $e) { throw new EntryException('The following error occurred during saving: ' . $e->getMessage()); } foreach ($section->fields as $field) { $entry->data()->{$field->{'element-name'}} = $field->loadDataFromDatabase($entry); } return $entry; }
public function current() { $record = parent::current(); $entry = new Entry(); foreach ($record as $key => $value) { $entry->{$key} = $value; } if (empty($this->data)) { return $entry; } // Load the section try { $section = Section::loadFromHandle($entry->section); } catch (SectionException $e) { throw new EntryException('Section specified, "' . $entry->section . '", in Entry object is invalid.'); } catch (Exception $e) { throw new EntryException('The following error occurred: ' . $e->getMessage()); } // Loop over the section fields, and in they are in the desired schema, populate an entry_data // array with the information. This doesn't respect fields allow_multiple setting though, although // I don't even think that's a problem to be honest as that validation should be taking place at the // entry creation level, not when it's being read. foreach ($section->fields as $field) { if (!empty($this->schema) && !in_array($field->{'element-name'}, $this->schema)) { continue; } $entry_data = array(); foreach ($this->data[$field->{'element-name'}] as $key => $data) { if ($data->{$field->fetchDataKey()} != $entry->id) { continue; } $entry_data[] = $data; } $entry->data()->{$field->{'element-name'}} = count($entry_data) == 1 ? current($entry_data) : $entry_data; } return $entry; }