Even more QA
This commit is contained in:
parent
6a07f7b24e
commit
bb4618c101
38
Event/IndexEvent.php
Normal file
38
Event/IndexEvent.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of the FOSElasticaBundle project.
|
||||||
|
*
|
||||||
|
* (c) Tim Nagel <tim@nagel.com.au>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace FOS\ElasticaBundle\Event;
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
|
|
||||||
|
class IndexEvent extends Event
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $index
|
||||||
|
*/
|
||||||
|
public function __construct($index)
|
||||||
|
{
|
||||||
|
$this->index = $index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getIndex()
|
||||||
|
{
|
||||||
|
return $this->index;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,23 +11,16 @@
|
||||||
|
|
||||||
namespace FOS\ElasticaBundle\Event;
|
namespace FOS\ElasticaBundle\Event;
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index Populate Event.
|
* Index Populate Event.
|
||||||
*
|
*
|
||||||
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
|
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
|
||||||
*/
|
*/
|
||||||
class IndexPopulateEvent extends Event
|
class IndexPopulateEvent extends IndexEvent
|
||||||
{
|
{
|
||||||
const PRE_INDEX_POPULATE = 'elastica.index.index_pre_populate';
|
const PRE_INDEX_POPULATE = 'elastica.index.index_pre_populate';
|
||||||
const POST_INDEX_POPULATE = 'elastica.index.index_post_populate';
|
const POST_INDEX_POPULATE = 'elastica.index.index_post_populate';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $index;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
|
@ -45,19 +38,12 @@ class IndexPopulateEvent extends Event
|
||||||
*/
|
*/
|
||||||
public function __construct($index, $reset, $options)
|
public function __construct($index, $reset, $options)
|
||||||
{
|
{
|
||||||
$this->index = $index;
|
parent::__construct($index);
|
||||||
|
|
||||||
$this->reset = $reset;
|
$this->reset = $reset;
|
||||||
$this->options = $options;
|
$this->options = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getIndex()
|
|
||||||
{
|
|
||||||
return $this->index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,14 +11,12 @@
|
||||||
|
|
||||||
namespace FOS\ElasticaBundle\Event;
|
namespace FOS\ElasticaBundle\Event;
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index ResetEvent.
|
* Index ResetEvent.
|
||||||
*
|
*
|
||||||
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
|
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
|
||||||
*/
|
*/
|
||||||
class IndexResetEvent extends Event
|
class IndexResetEvent extends IndexEvent
|
||||||
{
|
{
|
||||||
const PRE_INDEX_RESET = 'elastica.index.pre_reset';
|
const PRE_INDEX_RESET = 'elastica.index.pre_reset';
|
||||||
const POST_INDEX_RESET = 'elastica.index.post_reset';
|
const POST_INDEX_RESET = 'elastica.index.post_reset';
|
||||||
|
@ -28,11 +26,6 @@ class IndexResetEvent extends Event
|
||||||
*/
|
*/
|
||||||
private $force;
|
private $force;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $index;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
|
@ -45,17 +38,10 @@ class IndexResetEvent extends Event
|
||||||
*/
|
*/
|
||||||
public function __construct($index, $populating, $force)
|
public function __construct($index, $populating, $force)
|
||||||
{
|
{
|
||||||
$this->force = $force;
|
parent::__construct($index);
|
||||||
$this->index = $index;
|
|
||||||
$this->populating = $populating;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$this->force = $force;
|
||||||
* @return string
|
$this->populating = $populating;
|
||||||
*/
|
|
||||||
public function getIndex()
|
|
||||||
{
|
|
||||||
return $this->index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,16 +18,11 @@ use Symfony\Component\EventDispatcher\Event;
|
||||||
*
|
*
|
||||||
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
|
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
|
||||||
*/
|
*/
|
||||||
class TypeResetEvent extends Event
|
class TypeResetEvent extends IndexEvent
|
||||||
{
|
{
|
||||||
const PRE_TYPE_RESET = 'elastica.index.type_pre_reset';
|
const PRE_TYPE_RESET = 'elastica.index.type_pre_reset';
|
||||||
const POST_TYPE_RESET = 'elastica.index.type_post_reset';
|
const POST_TYPE_RESET = 'elastica.index.type_post_reset';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $index;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -39,16 +34,9 @@ class TypeResetEvent extends Event
|
||||||
*/
|
*/
|
||||||
public function __construct($index, $type)
|
public function __construct($index, $type)
|
||||||
{
|
{
|
||||||
$this->type = $type;
|
parent::__construct($index);
|
||||||
$this->index = $index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$this->type = $type;
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getIndex()
|
|
||||||
{
|
|
||||||
return $this->index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Provider extends AbstractProvider
|
||||||
->getArrayCopy();
|
->getArrayCopy();
|
||||||
|
|
||||||
$objects = array_filter($objects, array($this, 'isObjectIndexable'));
|
$objects = array_filter($objects, array($this, 'isObjectIndexable'));
|
||||||
if ($objects) {
|
if (!empty($objects)) {
|
||||||
$this->objectPersister->insertMany($objects);
|
$this->objectPersister->insertMany($objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ abstract class AbstractProvider implements ProviderInterface
|
||||||
protected $options;
|
protected $options;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Indexable
|
* @var IndexableInterface
|
||||||
*/
|
*/
|
||||||
private $indexable;
|
private $indexable;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use JMS\Serializer\SerializerInterface;
|
||||||
class Callback
|
class Callback
|
||||||
{
|
{
|
||||||
protected $serializer;
|
protected $serializer;
|
||||||
protected $groups;
|
protected $groups = array();
|
||||||
protected $version;
|
protected $version;
|
||||||
|
|
||||||
public function setSerializer($serializer)
|
public function setSerializer($serializer)
|
||||||
|
@ -41,7 +41,7 @@ class Callback
|
||||||
{
|
{
|
||||||
$context = $this->serializer instanceof SerializerInterface ? SerializationContext::create()->enableMaxDepthChecks() : array();
|
$context = $this->serializer instanceof SerializerInterface ? SerializationContext::create()->enableMaxDepthChecks() : array();
|
||||||
|
|
||||||
if ($this->groups) {
|
if (!empty($this->groups)) {
|
||||||
$context->setGroups($this->groups);
|
$context->setGroups($this->groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ class ObjectPersisterTest extends \PHPUnit_Framework_TestCase
|
||||||
private function getTransformer()
|
private function getTransformer()
|
||||||
{
|
{
|
||||||
$transformer = new ModelToElasticaAutoTransformer();
|
$transformer = new ModelToElasticaAutoTransformer();
|
||||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||||
|
|
||||||
return $transformer;
|
return $transformer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ class ObjectSerializerPersisterTest extends \PHPUnit_Framework_TestCase
|
||||||
private function getTransformer()
|
private function getTransformer()
|
||||||
{
|
{
|
||||||
$transformer = new ModelToElasticaIdentifierTransformer();
|
$transformer = new ModelToElasticaIdentifierTransformer();
|
||||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||||
|
|
||||||
return $transformer;
|
return $transformer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,10 +57,10 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $testQuery
|
* @param string $testQuery
|
||||||
* @param int $testLimit
|
* @param mixed $testLimit
|
||||||
* @param string $method
|
* @param string $method
|
||||||
*
|
*
|
||||||
* @return \FOS\ElasticaBundle\Finder\TransformedFinder|\PHPUnit_Framework_MockObject_MockObject
|
* @return \FOS\ElasticaBundle\Finder\TransformedFinder
|
||||||
*/
|
*/
|
||||||
private function getFinderMock($testQuery, $testLimit = null, $method = 'find')
|
private function getFinderMock($testQuery, $testLimit = null, $method = 'find')
|
||||||
{
|
{
|
||||||
|
|
|
@ -417,7 +417,7 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase
|
||||||
private function getTransformer($dispatcher = null)
|
private function getTransformer($dispatcher = null)
|
||||||
{
|
{
|
||||||
$transformer = new ModelToElasticaAutoTransformer(array(), $dispatcher);
|
$transformer = new ModelToElasticaAutoTransformer(array(), $dispatcher);
|
||||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||||
|
|
||||||
return $transformer;
|
return $transformer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class ModelToElasticaIdentifierTransformerTest extends \PHPUnit_Framework_TestCa
|
||||||
private function getTransformer()
|
private function getTransformer()
|
||||||
{
|
{
|
||||||
$transformer = new ModelToElasticaIdentifierTransformer();
|
$transformer = new ModelToElasticaIdentifierTransformer();
|
||||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||||
|
|
||||||
return $transformer;
|
return $transformer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue