Fixes function not found in entity taxonomy

This commit is contained in:
weryques 2019-01-21 10:32:22 -02:00
parent 73b47b0edf
commit aac9d2b85b
2 changed files with 6 additions and 6 deletions

View File

@ -37,6 +37,8 @@ class Entity_Factory {
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
try {
$type = trim($type);
if(empty($type)){
throw new \InvalidArgumentException('The type can\'t be empty');
} elseif(!strrchr($type, '_')){
@ -68,7 +70,7 @@ class Entity_Factory {
if (!empty($args) && $is_validated_and_in_db) {
foreach ($args as $attribute => $content) {
$set_ = 'set_' . $attribute;
$set_ = 'set_' . trim($attribute);
$this->entity->$set_( $content );
}
@ -80,7 +82,7 @@ class Entity_Factory {
} elseif (!empty($args) && !$is_validated_and_in_db){
foreach ($args as $attribute => $content) {
$set_ = 'set_' . $attribute;
$set_ = 'set_' . trim($attribute);
$this->entity->$set_( $content );
}

View File

@ -264,13 +264,11 @@ class Taxonomies extends TAINACAN_UnitTestCase {
'taxonomy',
array(
'name' => 'genero',
//'enabled_post_types ' => ['post']
'enabled_post_types' => ['post']
),
true
);
$taxonomy->set('enabled_post_types', ['post']);
$taxonomy = $Tainacan_Taxonomies->insert($taxonomy);
$pto = get_object_taxonomies('post');