Even more QA
This commit is contained in:
parent
6a07f7b24e
commit
bb4618c101
|
@ -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;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Index Populate Event.
|
||||
*
|
||||
* @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 POST_INDEX_POPULATE = 'elastica.index.index_post_populate';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $index;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -45,19 +38,12 @@ class IndexPopulateEvent extends Event
|
|||
*/
|
||||
public function __construct($index, $reset, $options)
|
||||
{
|
||||
$this->index = $index;
|
||||
parent::__construct($index);
|
||||
|
||||
$this->reset = $reset;
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
|
|
|
@ -11,14 +11,12 @@
|
|||
|
||||
namespace FOS\ElasticaBundle\Event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Index ResetEvent.
|
||||
*
|
||||
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
|
||||
*/
|
||||
class IndexResetEvent extends Event
|
||||
class IndexResetEvent extends IndexEvent
|
||||
{
|
||||
const PRE_INDEX_RESET = 'elastica.index.pre_reset';
|
||||
const POST_INDEX_RESET = 'elastica.index.post_reset';
|
||||
|
@ -28,11 +26,6 @@ class IndexResetEvent extends Event
|
|||
*/
|
||||
private $force;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $index;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -45,17 +38,10 @@ class IndexResetEvent extends Event
|
|||
*/
|
||||
public function __construct($index, $populating, $force)
|
||||
{
|
||||
$this->force = $force;
|
||||
$this->index = $index;
|
||||
$this->populating = $populating;
|
||||
}
|
||||
parent::__construct($index);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
return $this->index;
|
||||
$this->force = $force;
|
||||
$this->populating = $populating;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,16 +18,11 @@ use Symfony\Component\EventDispatcher\Event;
|
|||
*
|
||||
* @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 POST_TYPE_RESET = 'elastica.index.type_post_reset';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $index;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -39,16 +34,9 @@ class TypeResetEvent extends Event
|
|||
*/
|
||||
public function __construct($index, $type)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->index = $index;
|
||||
}
|
||||
parent::__construct($index);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
return $this->index;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class Provider extends AbstractProvider
|
|||
->getArrayCopy();
|
||||
|
||||
$objects = array_filter($objects, array($this, 'isObjectIndexable'));
|
||||
if ($objects) {
|
||||
if (!empty($objects)) {
|
||||
$this->objectPersister->insertMany($objects);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ abstract class AbstractProvider implements ProviderInterface
|
|||
protected $options;
|
||||
|
||||
/**
|
||||
* @var Indexable
|
||||
* @var IndexableInterface
|
||||
*/
|
||||
private $indexable;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use JMS\Serializer\SerializerInterface;
|
|||
class Callback
|
||||
{
|
||||
protected $serializer;
|
||||
protected $groups;
|
||||
protected $groups = array();
|
||||
protected $version;
|
||||
|
||||
public function setSerializer($serializer)
|
||||
|
@ -41,7 +41,7 @@ class Callback
|
|||
{
|
||||
$context = $this->serializer instanceof SerializerInterface ? SerializationContext::create()->enableMaxDepthChecks() : array();
|
||||
|
||||
if ($this->groups) {
|
||||
if (!empty($this->groups)) {
|
||||
$context->setGroups($this->groups);
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ class ObjectPersisterTest extends \PHPUnit_Framework_TestCase
|
|||
private function getTransformer()
|
||||
{
|
||||
$transformer = new ModelToElasticaAutoTransformer();
|
||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
||||
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||
|
||||
return $transformer;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class ObjectSerializerPersisterTest extends \PHPUnit_Framework_TestCase
|
|||
private function getTransformer()
|
||||
{
|
||||
$transformer = new ModelToElasticaIdentifierTransformer();
|
||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
||||
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||
|
||||
return $transformer;
|
||||
}
|
||||
|
|
|
@ -57,10 +57,10 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
/**
|
||||
* @param string $testQuery
|
||||
* @param int $testLimit
|
||||
* @param mixed $testLimit
|
||||
* @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')
|
||||
{
|
||||
|
|
|
@ -417,7 +417,7 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase
|
|||
private function getTransformer($dispatcher = null)
|
||||
{
|
||||
$transformer = new ModelToElasticaAutoTransformer(array(), $dispatcher);
|
||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
||||
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||
|
||||
return $transformer;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class ModelToElasticaIdentifierTransformerTest extends \PHPUnit_Framework_TestCa
|
|||
private function getTransformer()
|
||||
{
|
||||
$transformer = new ModelToElasticaIdentifierTransformer();
|
||||
$transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
|
||||
$transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
|
||||
|
||||
return $transformer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue