namespace object is not saved right in metadata too

This commit is contained in:
Jacson Passold 2017-11-15 19:07:44 -02:00
parent 7cf39adbfc
commit fbe81d8a7b
2 changed files with 8 additions and 5 deletions

View File

@ -79,11 +79,11 @@ class Metadata extends \Tainacan\Entity {
} }
function get_field_type_object(){ function get_field_type_object(){
return unserialize( $this->get_mapped_property('field_type_object') ); return unserialize(base64_decode( $this->get_mapped_property('field_type_object') ) );
} }
function get_field_type(){ function get_field_type(){
return $this->get_mapped_property('field_type'); return base64_decode($this->get_mapped_property('field_type'));
} }
// Setters // Setters
@ -133,7 +133,7 @@ class Metadata extends \Tainacan\Entity {
function set_field_type_object(\Tainacan\Field_Types\Field_Type $value){ function set_field_type_object(\Tainacan\Field_Types\Field_Type $value){
$this->set_field_type( get_class( $value ) ); $this->set_field_type( get_class( $value ) );
return $this->set_mapped_property('field_type_object', serialize($value) ) ; return $this->set_mapped_property('field_type_object', base64_encode( serialize($value) ) ); // Encode to avoid backslaches removal
} }
/** /**
@ -143,7 +143,7 @@ class Metadata extends \Tainacan\Entity {
* *
*/ */
private function set_field_type($value){ private function set_field_type($value){
return $this->set_mapped_property('field_type', $value ) ; return $this->set_mapped_property('field_type', base64_encode($value) ) ; // Encode to avoid backslaches removal
} }
// helpers // helpers

View File

@ -1,4 +1,7 @@
<?php <?php
namespace Tainacan\Tests;
/** /**
* Class TestCollections * Class TestCollections
* *
@ -8,7 +11,7 @@
/** /**
* Sample test case. * Sample test case.
*/ */
class Test_Taxonomies extends WP_UnitTestCase { class Taxonomies extends \WP_UnitTestCase {
/** /**