function populate(int $document_id, &$document) { $document_id = (int) $document_id; if ($document == null) { $document = new controller_document($document_id); $document->set_title($this->unmarshal($this->db->f('document_title', true), 'string')); $document->set_description($this->unmarshal($this->db->f('description', true), 'string')); $document->set_name($this->unmarshal($this->db->f('name', true), 'string')); $document->set_type($this->unmarshal($this->db->f('type_title', true), 'string')); $document->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 'int')); } return $document; }