2011-07-14 20:49:18 +02:00
|
|
|
<?php
|
|
|
|
|
2013-03-27 18:44:06 +01:00
|
|
|
namespace FOS\ElasticaBundle\Tests\Transformer\ModelToElasticaAutoTransformer;
|
2011-07-14 20:49:18 +02:00
|
|
|
|
2015-01-20 04:00:10 +01:00
|
|
|
use FOS\ElasticaBundle\Event\TransformEvent;
|
2013-03-27 18:44:06 +01:00
|
|
|
use FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer;
|
2013-03-27 22:19:50 +01:00
|
|
|
use Symfony\Component\PropertyAccess\PropertyAccess;
|
2011-07-14 20:49:18 +02:00
|
|
|
|
2011-12-05 22:44:12 +01:00
|
|
|
class POPO
|
2011-07-14 20:49:18 +02:00
|
|
|
{
|
2012-07-08 15:31:19 +02:00
|
|
|
public $id = 123;
|
|
|
|
public $name = 'someName';
|
|
|
|
private $desc = 'desc';
|
|
|
|
public $float = 7.2;
|
|
|
|
public $bool = true;
|
2012-02-14 18:08:38 +01:00
|
|
|
public $falseBool = false;
|
2011-12-05 22:44:12 +01:00
|
|
|
public $date;
|
2012-02-14 18:08:38 +01:00
|
|
|
public $nullValue;
|
2012-04-19 22:26:19 +02:00
|
|
|
public $file;
|
|
|
|
public $fileContents;
|
2011-12-05 22:44:12 +01:00
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
2012-04-19 22:26:19 +02:00
|
|
|
$this->date = new \DateTime('1979-05-05');
|
2015-03-12 11:20:00 +01:00
|
|
|
$this->file = new \SplFileInfo(__DIR__.'/../fixtures/attachment.odt');
|
|
|
|
$this->fileContents = file_get_contents(__DIR__.'/../fixtures/attachment.odt');
|
2011-12-05 22:44:12 +01:00
|
|
|
}
|
2011-07-14 20:49:18 +02:00
|
|
|
|
|
|
|
public function getId()
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIterator()
|
|
|
|
{
|
|
|
|
$iterator = new \ArrayIterator();
|
|
|
|
$iterator->append('value1');
|
|
|
|
|
|
|
|
return $iterator;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getArray()
|
|
|
|
{
|
2012-07-08 15:31:19 +02:00
|
|
|
return array(
|
|
|
|
'key1' => 'value1',
|
2015-03-12 11:20:00 +01:00
|
|
|
'key2' => 'value2',
|
2012-07-08 15:31:19 +02:00
|
|
|
);
|
2011-07-14 20:49:18 +02:00
|
|
|
}
|
2011-12-05 22:44:12 +01:00
|
|
|
|
|
|
|
public function getMultiArray()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'key1' => 'value1',
|
|
|
|
'key2' => array('value2', false, 123, 8.9, new \DateTime('1978-09-07')),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBool()
|
|
|
|
{
|
|
|
|
return $this->bool;
|
|
|
|
}
|
|
|
|
|
2012-02-14 18:08:38 +01:00
|
|
|
public function getFalseBool()
|
|
|
|
{
|
|
|
|
return $this->falseBool;
|
|
|
|
}
|
|
|
|
|
2011-12-05 22:44:12 +01:00
|
|
|
public function getFloat()
|
|
|
|
{
|
|
|
|
return $this->float;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDate()
|
|
|
|
{
|
|
|
|
return $this->date;
|
|
|
|
}
|
|
|
|
|
2012-02-14 18:08:38 +01:00
|
|
|
public function getNullValue()
|
|
|
|
{
|
|
|
|
return $this->nullValue;
|
|
|
|
}
|
|
|
|
|
2012-04-19 22:26:19 +02:00
|
|
|
public function getFile()
|
|
|
|
{
|
|
|
|
return $this->file;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFileContents()
|
|
|
|
{
|
|
|
|
return $this->file;
|
|
|
|
}
|
2012-11-26 14:37:47 +01:00
|
|
|
|
|
|
|
public function getSub()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
(object) array('foo' => 'foo', 'bar' => 'foo', 'id' => 1),
|
|
|
|
(object) array('foo' => 'bar', 'bar' => 'bar', 'id' => 2),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-05-24 13:27:37 +02:00
|
|
|
public function getObj()
|
|
|
|
{
|
|
|
|
return array('foo' => 'foo', 'bar' => 'foo', 'id' => 1);
|
|
|
|
}
|
|
|
|
|
2014-04-20 03:41:41 +02:00
|
|
|
public function getNestedObject()
|
|
|
|
{
|
2015-03-12 11:20:00 +01:00
|
|
|
return array('key1' => (object) array('id' => 1, 'key1sub1' => 'value1sub1', 'key1sub2' => 'value1sub2'));
|
2014-04-20 03:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-26 14:37:47 +01:00
|
|
|
public function getUpper()
|
|
|
|
{
|
|
|
|
return (object) array('id' => 'parent', 'name' => 'a random name');
|
|
|
|
}
|
2013-06-19 13:57:15 +02:00
|
|
|
|
|
|
|
public function getUpperAlias()
|
|
|
|
{
|
|
|
|
return $this->getUpper();
|
|
|
|
}
|
2011-07-14 20:49:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
2015-01-20 04:00:10 +01:00
|
|
|
public function testTransformerDispatches()
|
|
|
|
{
|
|
|
|
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')
|
|
|
|
->getMock();
|
|
|
|
$dispatcher->expects($this->once())
|
|
|
|
->method('dispatch')
|
|
|
|
->with(
|
|
|
|
TransformEvent::POST_TRANSFORM,
|
|
|
|
$this->isInstanceOf('FOS\ElasticaBundle\Event\TransformEvent')
|
|
|
|
);
|
|
|
|
|
|
|
|
$transformer = $this->getTransformer($dispatcher);
|
|
|
|
$transformer->transform(new POPO(), array());
|
|
|
|
}
|
|
|
|
|
2015-02-08 23:32:39 +01:00
|
|
|
public function testPropertyPath()
|
|
|
|
{
|
|
|
|
$transformer = $this->getTransformer();
|
|
|
|
|
|
|
|
$document = $transformer->transform(new POPO(), array('name' => array('property_path' => false)));
|
|
|
|
$this->assertInstanceOf('Elastica\Document', $document);
|
|
|
|
$this->assertFalse($document->has('name'));
|
|
|
|
|
|
|
|
$document = $transformer->transform(new POPO(), array('realName' => array('property_path' => 'name')));
|
|
|
|
$this->assertInstanceOf('Elastica\Document', $document);
|
|
|
|
$this->assertTrue($document->has('realName'));
|
|
|
|
$this->assertEquals('someName', $document->get('realName'));
|
|
|
|
}
|
|
|
|
|
2011-07-14 20:49:18 +02:00
|
|
|
public function testThatCanTransformObject()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$document = $transformer->transform(new POPO(), array('name' => array()));
|
2011-07-14 20:49:18 +02:00
|
|
|
$data = $document->getData();
|
2011-12-05 22:44:12 +01:00
|
|
|
|
2013-04-22 13:20:10 +02:00
|
|
|
$this->assertInstanceOf('Elastica\Document', $document);
|
2011-07-14 20:49:18 +02:00
|
|
|
$this->assertEquals(123, $document->getId());
|
|
|
|
$this->assertEquals('someName', $data['name']);
|
|
|
|
}
|
2011-12-05 22:44:12 +01:00
|
|
|
|
|
|
|
public function testThatCanTransformObjectWithCorrectTypes()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-07-08 16:38:09 +02:00
|
|
|
$document = $transformer->transform(
|
|
|
|
new POPO(), array(
|
|
|
|
'name' => array(),
|
|
|
|
'float' => array(),
|
|
|
|
'bool' => array(),
|
|
|
|
'date' => array(),
|
2015-03-12 11:20:00 +01:00
|
|
|
'falseBool' => array(),
|
2012-07-08 16:38:09 +02:00
|
|
|
)
|
|
|
|
);
|
2011-12-05 22:44:12 +01:00
|
|
|
$data = $document->getData();
|
|
|
|
|
2013-04-22 13:20:10 +02:00
|
|
|
$this->assertInstanceOf('Elastica\Document', $document);
|
2011-12-05 22:44:12 +01:00
|
|
|
$this->assertEquals(123, $document->getId());
|
|
|
|
$this->assertEquals('someName', $data['name']);
|
|
|
|
$this->assertEquals(7.2, $data['float']);
|
|
|
|
$this->assertEquals(true, $data['bool']);
|
2012-02-14 18:08:38 +01:00
|
|
|
$this->assertEquals(false, $data['falseBool']);
|
2011-12-05 22:44:12 +01:00
|
|
|
$expectedDate = new \DateTime('1979-05-05');
|
2013-03-07 23:53:08 +01:00
|
|
|
$this->assertEquals($expectedDate->format('c'), $data['date']);
|
2011-12-05 22:44:12 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 20:49:18 +02:00
|
|
|
public function testThatCanTransformObjectWithIteratorValue()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$document = $transformer->transform(new POPO(), array('iterator' => array()));
|
2011-07-14 20:49:18 +02:00
|
|
|
$data = $document->getData();
|
2011-12-05 22:44:12 +01:00
|
|
|
|
2011-07-14 20:49:18 +02:00
|
|
|
$this->assertEquals(array('value1'), $data['iterator']);
|
|
|
|
}
|
2011-12-05 22:44:12 +01:00
|
|
|
|
2011-07-14 20:49:18 +02:00
|
|
|
public function testThatCanTransformObjectWithArrayValue()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$document = $transformer->transform(new POPO(), array('array' => array()));
|
2011-07-14 20:49:18 +02:00
|
|
|
$data = $document->getData();
|
2011-12-05 22:44:12 +01:00
|
|
|
|
2012-07-08 15:31:19 +02:00
|
|
|
$this->assertEquals(
|
|
|
|
array(
|
|
|
|
'key1' => 'value1',
|
2015-03-12 11:20:00 +01:00
|
|
|
'key2' => 'value2',
|
2012-07-08 15:31:19 +02:00
|
|
|
), $data['array']
|
|
|
|
);
|
2011-07-14 20:49:18 +02:00
|
|
|
}
|
|
|
|
|
2011-12-05 22:44:12 +01:00
|
|
|
public function testThatCanTransformObjectWithMultiDimensionalArrayValue()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$document = $transformer->transform(new POPO(), array('multiArray' => array()));
|
2011-12-05 22:44:12 +01:00
|
|
|
$data = $document->getData();
|
|
|
|
|
|
|
|
$expectedDate = new \DateTime('1978-09-07');
|
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
array(
|
|
|
|
'key1' => 'value1',
|
2013-03-07 23:53:08 +01:00
|
|
|
'key2' => array('value2', false, 123, 8.9, $expectedDate->format('c')),
|
2011-12-05 22:44:12 +01:00
|
|
|
), $data['multiArray']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-02-27 20:37:59 +01:00
|
|
|
public function testThatNullValuesAreNotFilteredOut()
|
2012-02-14 18:08:38 +01:00
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$document = $transformer->transform(new POPO(), array('nullValue' => array()));
|
2012-02-14 18:08:38 +01:00
|
|
|
$data = $document->getData();
|
|
|
|
|
2012-02-27 20:37:59 +01:00
|
|
|
$this->assertTrue(array_key_exists('nullValue', $data));
|
2012-02-14 18:08:38 +01:00
|
|
|
}
|
|
|
|
|
2013-05-02 17:24:27 +02:00
|
|
|
/**
|
|
|
|
* @expectedException Symfony\Component\PropertyAccess\Exception\RuntimeException
|
|
|
|
*/
|
2012-07-08 15:31:19 +02:00
|
|
|
public function testThatCannotTransformObjectWhenGetterDoesNotExistForPrivateMethod()
|
2011-07-14 20:49:18 +02:00
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$transformer->transform(new POPO(), array('desc' => array()));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testFileAddedForAttachmentMapping()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$document = $transformer->transform(new POPO(), array('file' => array('type' => 'attachment')));
|
|
|
|
$data = $document->getData();
|
|
|
|
|
2015-03-12 11:20:00 +01:00
|
|
|
$this->assertEquals(base64_encode(file_get_contents(__DIR__.'/../fixtures/attachment.odt')), $data['file']);
|
2012-04-19 22:26:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testFileContentsAddedForAttachmentMapping()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-04-19 22:26:19 +02:00
|
|
|
$document = $transformer->transform(new POPO(), array('fileContents' => array('type' => 'attachment')));
|
|
|
|
$data = $document->getData();
|
|
|
|
|
2012-07-08 16:38:09 +02:00
|
|
|
$this->assertEquals(
|
2015-03-12 11:20:00 +01:00
|
|
|
base64_encode(file_get_contents(__DIR__.'/../fixtures/attachment.odt')), $data['fileContents']
|
2012-07-08 16:38:09 +02:00
|
|
|
);
|
2011-07-14 20:49:18 +02:00
|
|
|
}
|
2012-11-26 14:37:47 +01:00
|
|
|
|
|
|
|
public function testNestedMapping()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-11-26 14:37:47 +01:00
|
|
|
$document = $transformer->transform(new POPO(), array(
|
2015-03-12 11:57:26 +01:00
|
|
|
'sub' => array(
|
|
|
|
'type' => 'nested',
|
|
|
|
'properties' => array('foo' => array()),
|
|
|
|
),
|
|
|
|
));
|
2012-11-26 14:37:47 +01:00
|
|
|
$data = $document->getData();
|
|
|
|
|
|
|
|
$this->assertTrue(array_key_exists('sub', $data));
|
|
|
|
$this->assertInternalType('array', $data['sub']);
|
|
|
|
$this->assertEquals(array(
|
|
|
|
array('foo' => 'foo'),
|
2015-03-12 11:20:00 +01:00
|
|
|
array('foo' => 'bar'),
|
2012-11-26 14:37:47 +01:00
|
|
|
), $data['sub']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tesObjectMapping()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-11-26 14:37:47 +01:00
|
|
|
$document = $transformer->transform(new POPO(), array(
|
|
|
|
'sub' => array(
|
|
|
|
'type' => 'object',
|
2015-03-12 11:20:00 +01:00
|
|
|
'properties' => array('bar'),
|
|
|
|
),
|
2012-11-26 14:37:47 +01:00
|
|
|
));
|
|
|
|
$data = $document->getData();
|
|
|
|
|
|
|
|
$this->assertTrue(array_key_exists('sub', $data));
|
|
|
|
$this->assertInternalType('array', $data['sub']);
|
|
|
|
$this->assertEquals(array(
|
|
|
|
array('bar' => 'foo'),
|
2015-03-12 11:20:00 +01:00
|
|
|
array('bar' => 'bar'),
|
2012-11-26 14:37:47 +01:00
|
|
|
), $data['sub']);
|
|
|
|
}
|
|
|
|
|
2013-05-24 13:27:37 +02:00
|
|
|
public function testObjectDoesNotRequireProperties()
|
|
|
|
{
|
|
|
|
$transformer = $this->getTransformer();
|
|
|
|
$document = $transformer->transform(new POPO(), array(
|
|
|
|
'obj' => array(
|
2015-03-12 11:20:00 +01:00
|
|
|
'type' => 'object',
|
|
|
|
),
|
2013-05-24 13:27:37 +02:00
|
|
|
));
|
|
|
|
$data = $document->getData();
|
|
|
|
|
|
|
|
$this->assertTrue(array_key_exists('obj', $data));
|
|
|
|
$this->assertInternalType('array', $data['obj']);
|
|
|
|
$this->assertEquals(array(
|
2015-01-20 04:00:10 +01:00
|
|
|
'foo' => 'foo',
|
|
|
|
'bar' => 'foo',
|
2015-03-12 11:20:00 +01:00
|
|
|
'id' => 1,
|
2015-03-12 11:57:26 +01:00
|
|
|
), $data['obj']);
|
2013-05-24 13:27:37 +02:00
|
|
|
}
|
|
|
|
|
2014-04-20 03:41:41 +02:00
|
|
|
public function testObjectsMappingOfAtLeastOneAutoMappedObjectAndAtLeastOneManuallyMappedObject()
|
|
|
|
{
|
|
|
|
$transformer = $this->getTransformer();
|
|
|
|
$document = $transformer->transform(
|
|
|
|
new POPO(),
|
|
|
|
array(
|
|
|
|
'obj' => array('type' => 'object', 'properties' => array()),
|
|
|
|
'nestedObject' => array(
|
|
|
|
'type' => 'object',
|
|
|
|
'properties' => array(
|
|
|
|
'key1sub1' => array(
|
|
|
|
'type' => 'string',
|
2015-03-12 11:20:00 +01:00
|
|
|
'properties' => array(),
|
2014-04-20 03:41:41 +02:00
|
|
|
),
|
|
|
|
'key1sub2' => array(
|
|
|
|
'type' => 'string',
|
2015-03-12 11:20:00 +01:00
|
|
|
'properties' => array(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2014-04-20 03:41:41 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
$data = $document->getData();
|
|
|
|
|
|
|
|
$this->assertTrue(array_key_exists('obj', $data));
|
|
|
|
$this->assertTrue(array_key_exists('nestedObject', $data));
|
|
|
|
$this->assertInternalType('array', $data['obj']);
|
|
|
|
$this->assertInternalType('array', $data['nestedObject']);
|
|
|
|
$this->assertEquals(
|
|
|
|
array(
|
|
|
|
'foo' => 'foo',
|
|
|
|
'bar' => 'foo',
|
2015-03-12 11:20:00 +01:00
|
|
|
'id' => 1,
|
2014-04-20 03:41:41 +02:00
|
|
|
),
|
|
|
|
$data['obj']
|
|
|
|
);
|
|
|
|
$this->assertEquals(
|
|
|
|
array(
|
|
|
|
'key1sub1' => 'value1sub1',
|
2015-03-12 11:20:00 +01:00
|
|
|
'key1sub2' => 'value1sub2',
|
2014-04-20 03:41:41 +02:00
|
|
|
),
|
|
|
|
$data['nestedObject'][0]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-11-26 14:37:47 +01:00
|
|
|
public function testParentMapping()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-11-26 14:37:47 +01:00
|
|
|
$document = $transformer->transform(new POPO(), array(
|
2015-03-12 11:20:00 +01:00
|
|
|
'_parent' => array('type' => 'upper', 'property' => 'upper', 'identifier' => 'id'),
|
2013-06-17 21:19:11 +02:00
|
|
|
));
|
2012-11-26 14:37:47 +01:00
|
|
|
|
|
|
|
$this->assertEquals("parent", $document->getParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testParentMappingWithCustomIdentifier()
|
|
|
|
{
|
2013-03-27 22:19:50 +01:00
|
|
|
$transformer = $this->getTransformer();
|
2012-11-26 14:37:47 +01:00
|
|
|
$document = $transformer->transform(new POPO(), array(
|
2015-03-12 11:20:00 +01:00
|
|
|
'_parent' => array('type' => 'upper', 'property' => 'upper', 'identifier' => 'name'),
|
2013-06-17 21:19:11 +02:00
|
|
|
));
|
2012-11-26 14:37:47 +01:00
|
|
|
|
|
|
|
$this->assertEquals("a random name", $document->getParent());
|
|
|
|
}
|
2013-03-27 22:19:50 +01:00
|
|
|
|
2013-06-19 13:57:15 +02:00
|
|
|
public function testParentMappingWithNullProperty()
|
|
|
|
{
|
|
|
|
$transformer = $this->getTransformer();
|
|
|
|
$document = $transformer->transform(new POPO(), array(
|
2015-03-12 11:20:00 +01:00
|
|
|
'_parent' => array('type' => 'upper', 'property' => null, 'identifier' => 'id'),
|
2013-06-19 13:57:15 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
$this->assertEquals("parent", $document->getParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testParentMappingWithCustomProperty()
|
|
|
|
{
|
|
|
|
$transformer = $this->getTransformer();
|
|
|
|
$document = $transformer->transform(new POPO(), array(
|
2015-03-12 11:20:00 +01:00
|
|
|
'_parent' => array('type' => 'upper', 'property' => 'upperAlias', 'identifier' => 'id'),
|
2013-06-19 13:57:15 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
$this->assertEquals("parent", $document->getParent());
|
|
|
|
}
|
|
|
|
|
2013-03-27 22:19:50 +01:00
|
|
|
/**
|
2015-01-20 04:00:10 +01:00
|
|
|
* @param null|\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
|
2015-03-12 11:45:24 +01:00
|
|
|
*
|
2013-03-27 22:19:50 +01:00
|
|
|
* @return ModelToElasticaAutoTransformer
|
|
|
|
*/
|
2015-01-20 04:00:10 +01:00
|
|
|
private function getTransformer($dispatcher = null)
|
2013-03-27 22:19:50 +01:00
|
|
|
{
|
2015-01-20 04:00:10 +01:00
|
|
|
$transformer = new ModelToElasticaAutoTransformer(array(), $dispatcher);
|
2015-03-13 09:34:56 +01:00
|
|
|
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
2013-03-27 22:19:50 +01:00
|
|
|
|
|
|
|
return $transformer;
|
|
|
|
}
|
2011-07-14 20:49:18 +02:00
|
|
|
}
|