add metadata type object to filter array object

This commit is contained in:
leogermani 2018-11-14 12:10:11 -02:00 committed by Mateus Machado Luna
parent 8fe90b82e8
commit e35ad08309
2 changed files with 15 additions and 1 deletions

View File

@ -41,10 +41,12 @@ class Filter extends Entity {
public function _toArray(){
$filter_array = parent::_toArray();
$metadatum_id = $filter_array['metadatum'];
$metadatum = $this->get_metadatum();
$filter_array['metadatum'] = [];
$filter_array['metadatum']['metadatum_id'] = $metadatum_id;
$filter_array['metadatum']['metadatum_name'] = $this->get_metadatum()->get_name();
$filter_array['metadatum']['metadatum_name'] = $metadatum->get_name();
$filter_array['metadatum']['metadata_type_object'] = $metadatum->get_metadata_type_object()->_toArray();
return $filter_array;
}

View File

@ -180,4 +180,16 @@ class Taxonomy extends Metadata_Type {
}
public function _toArray() {
$array = parent::_toArray();
if ( isset($array['options']['taxonomy_id']) ) {
$array['options']['taxonomy'] = \Tainacan\Repositories\Taxonomies::get_instance()->get_db_identifier_by_id( $array['options']['taxonomy_id'] );
}
return $array;
}
}