More information o importer REST response (refs #63)

This commit is contained in:
Leo Germani 2018-06-19 10:06:55 -03:00
parent f2fe699369
commit 4a4c395b24
2 changed files with 9 additions and 2 deletions

View File

@ -28,7 +28,7 @@ class Importer_Handler {
} }
function add_to_queue(\Tainacan\Importer\Importer $importer_object) { function add_to_queue(\Tainacan\Importer\Importer $importer_object) {
$data = $importer_object->_to_Array(); $data = $importer_object->_to_Array(true);
$importer_object = $this->bg_importer->data($data)->save()->dispatch(); $importer_object = $this->bg_importer->data($data)->save()->dispatch();
return $importer_object; return $importer_object;
} }

View File

@ -179,13 +179,20 @@ abstract class Importer {
} }
public function _to_Array() { public function _to_Array($short = false) {
$return = ['id' => $this->get_id()]; $return = ['id' => $this->get_id()];
foreach ($this->array_attributes as $attr) { foreach ($this->array_attributes as $attr) {
$method = 'get_' . $attr; $method = 'get_' . $attr;
$return[$attr] = $this->$method(); $return[$attr] = $this->$method();
} }
$return['class_name'] = get_class($this); $return['class_name'] = get_class($this);
if ($short === false) {
$return['manual_collection'] = $this->manual_collection;
$return['manual_mapping'] = $this->manual_mapping;
$return['accepts'] = $this->accepts;
}
return $return; return $return;
} }