Skip to content
Snippets Groups Projects
Commit 80fd5609 authored by Martynas Sudintas's avatar Martynas Sudintas Committed by Simonas Šerlinskas
Browse files

serializer in search is now static (#268)

parent ffb35940
No related branches found
No related tags found
No related merge requests found
...@@ -155,7 +155,7 @@ class Search ...@@ -155,7 +155,7 @@ class Search
/** /**
* @var OrderedSerializer * @var OrderedSerializer
*/ */
private $serializer; private static $serializer;
/** /**
* @var SearchEndpointInterface[] * @var SearchEndpointInterface[]
...@@ -167,12 +167,14 @@ class Search ...@@ -167,12 +167,14 @@ class Search
*/ */
public function __construct() public function __construct()
{ {
$this->serializer = new OrderedSerializer( if (static::$serializer === null) {
[ static::$serializer = new OrderedSerializer(
new CustomReferencedNormalizer(), [
new CustomNormalizer(), new CustomReferencedNormalizer(),
] new CustomNormalizer(),
); ]
);
}
} }
/** /**
...@@ -698,7 +700,7 @@ class Search ...@@ -698,7 +700,7 @@ class Search
*/ */
public function toArray() public function toArray()
{ {
$output = array_filter($this->serializer->normalize($this->endpoints)); $output = array_filter(static::$serializer->normalize($this->endpoints));
$params = [ $params = [
'from' => 'from', 'from' => 'from',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment