various tweaks

This commit is contained in:
Lukas Kahwe Smith 2013-04-22 17:00:26 +02:00
parent 965ee39c5a
commit 8a9a9686ba
3 changed files with 8 additions and 8 deletions

View file

@ -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);

View file

@ -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:

View file

@ -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) {