removed duplicate methods
This commit is contained in:
parent
6c4740b292
commit
e0ef8dff23
|
@ -23,69 +23,6 @@ class ObjectSerializerPersister extends ObjectPersister
|
|||
$this->serializer = $serializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert one object into the type
|
||||
* The object will be transformed to an elastica document
|
||||
*
|
||||
* @param object $object
|
||||
*/
|
||||
public function insertOne($object)
|
||||
{
|
||||
$document = $this->transformToElasticaDocument($object);
|
||||
$this->type->addDocument($document);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces one object in the type
|
||||
*
|
||||
* @param object $object
|
||||
* @return null
|
||||
*/
|
||||
public function replaceOne($object)
|
||||
{
|
||||
$document = $this->transformToElasticaDocument($object);
|
||||
$this->type->deleteById($document->getId());
|
||||
$this->type->addDocument($document);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes one object in the type
|
||||
*
|
||||
* @param object $object
|
||||
* @return null
|
||||
**/
|
||||
public function deleteOne($object)
|
||||
{
|
||||
$document = $this->transformToElasticaDocument($object);
|
||||
$this->type->deleteById($document->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes one object in the type by id
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return null
|
||||
**/
|
||||
public function deleteById($id)
|
||||
{
|
||||
$this->type->deleteById($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an array of objects in the type
|
||||
*
|
||||
* @param array $objects array of domain model objects
|
||||
**/
|
||||
public function insertMany(array $objects)
|
||||
{
|
||||
$docs = array();
|
||||
foreach ($objects as $object) {
|
||||
$docs[] = $this->transformToElasticaDocument($object);
|
||||
}
|
||||
$this->type->addDocuments($docs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms an object to an elastica document
|
||||
* with just the identifier set
|
||||
|
|
Loading…
Reference in a new issue