From 8a9a9686babbff82320fd8e249d5d6f2719e6de5 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Mon, 22 Apr 2013 17:00:26 +0200 Subject: [PATCH] various tweaks --- DependencyInjection/FOSElasticaExtension.php | 2 +- README.md | 10 +++++----- Serializer/Callback.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/DependencyInjection/FOSElasticaExtension.php b/DependencyInjection/FOSElasticaExtension.php index 8628199..e67ba53 100644 --- a/DependencyInjection/FOSElasticaExtension.php +++ b/DependencyInjection/FOSElasticaExtension.php @@ -190,7 +190,7 @@ class FOSElasticaExtension extends Extension $serializerDef->addMethodCall('setGroups', array($type['serializer']['groups'])); } if (isset($type['serializer']['version'])) { - $serializerDef->addMethodCall('version', array($type['serializer']['version'])); + $serializerDef->addMethodCall('setVersion', array($type['serializer']['version'])); } $container->setDefinition($serializerId, $serializerDef); diff --git a/README.md b/README.md index 02c600f..87b01aa 100644 --- a/README.md +++ b/README.md @@ -71,11 +71,11 @@ Elastica can handle objects instead of data arrays if a serializer callable is c callback: callback serializer: serializer -"callback" is the name of a parameter defining a class having a public method serialize($object). "serializer" is the service id for the -actual serializer, e.g. 'serializer' if you're using the JMSSerializerBundle. If this is configured you can use -\Elastica\Type::addObject instead of \Elastica\Type::addDocument to add data to the index. -The bundle provides a default implementation with a serializer service id 'serializer' that can be turned on by adding -the following line to your config. +``callback`` is the name of a parameter defining a class having a public method serialize($object). +``serializer`` is the service id for the actual serializer, e.g. ``serializer`` if you're using +JMSSerializerBundle. If this is configured you can use ``\Elastica\Type::addObject`` instead of +``\Elastica\Type::addDocument`` to add data to the index. The bundle provides a default implementation +with a serializer service id 'serializer' that can be turned on by adding the following line to your config. #app/config/config.yml fos_elastica: diff --git a/Serializer/Callback.php b/Serializer/Callback.php index a563da9..fbf391e 100644 --- a/Serializer/Callback.php +++ b/Serializer/Callback.php @@ -3,7 +3,7 @@ namespace FOS\ElasticaBundle\Serializer; use JMS\Serializer\SerializationContext; -use JMS\Serializer\Serializer; +use JMS\Serializer\SerializerInterface; class Callback { @@ -30,7 +30,7 @@ class Callback public function serialize($object) { - $context = $this->serializer instanceof Serializer ? new SerializationContext() : null; + $context = $this->serializer instanceof SerializerInterface ? new SerializationContext() : array(); if ($this->groups) { if (!$context) {