2011-06-07 20:13:34 +02:00
|
|
|
<?php
|
|
|
|
|
2013-03-27 18:44:06 +01:00
|
|
|
namespace FOS\ElasticaBundle\Persister;
|
2011-06-07 20:13:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Inserts, replaces and deletes single documents in an elastica type
|
2015-03-12 11:20:00 +01:00
|
|
|
* Accepts domain model objects and converts them to elastica documents.
|
2011-06-07 20:13:34 +02:00
|
|
|
*
|
|
|
|
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
|
|
|
|
*/
|
|
|
|
interface ObjectPersisterInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Insert one object into the type
|
2015-03-12 11:20:00 +01:00
|
|
|
* The object will be transformed to an elastica document.
|
2011-06-07 20:13:34 +02:00
|
|
|
*
|
|
|
|
* @param object $object
|
|
|
|
*/
|
2015-03-12 11:20:00 +01:00
|
|
|
public function insertOne($object);
|
2011-06-07 20:13:34 +02:00
|
|
|
|
|
|
|
/**
|
2015-03-12 11:20:00 +01:00
|
|
|
* Replaces one object in the type.
|
2011-06-07 20:13:34 +02:00
|
|
|
*
|
|
|
|
* @param object $object
|
|
|
|
**/
|
2015-03-12 11:20:00 +01:00
|
|
|
public function replaceOne($object);
|
2011-06-07 20:13:34 +02:00
|
|
|
|
|
|
|
/**
|
2015-03-12 11:20:00 +01:00
|
|
|
* Deletes one object in the type.
|
2011-06-07 20:13:34 +02:00
|
|
|
*
|
|
|
|
* @param object $object
|
|
|
|
**/
|
2015-03-12 11:20:00 +01:00
|
|
|
public function deleteOne($object);
|
2011-06-07 20:13:34 +02:00
|
|
|
|
2012-01-25 20:51:10 +01:00
|
|
|
/**
|
2015-03-12 11:20:00 +01:00
|
|
|
* Deletes one object in the type by id.
|
2012-01-25 20:51:10 +01:00
|
|
|
*
|
|
|
|
* @param mixed $id
|
2014-02-01 03:14:21 +01:00
|
|
|
*/
|
2015-03-12 11:20:00 +01:00
|
|
|
public function deleteById($id);
|
2012-01-25 20:51:10 +01:00
|
|
|
|
2011-06-07 20:13:34 +02:00
|
|
|
/**
|
2015-03-12 11:20:00 +01:00
|
|
|
* Bulk inserts an array of objects in the type.
|
2014-02-01 03:14:21 +01:00
|
|
|
*
|
|
|
|
* @param array $objects array of domain model objects
|
|
|
|
*/
|
2015-03-12 11:20:00 +01:00
|
|
|
public function insertMany(array $objects);
|
2014-02-01 03:14:21 +01:00
|
|
|
|
|
|
|
/**
|
2015-03-12 11:20:00 +01:00
|
|
|
* Bulk updates an array of objects in the type.
|
2014-02-01 03:14:21 +01:00
|
|
|
*
|
|
|
|
* @param array $objects array of domain model objects
|
|
|
|
*/
|
2015-03-12 11:20:00 +01:00
|
|
|
public function replaceMany(array $objects);
|
2014-02-01 03:14:21 +01:00
|
|
|
|
|
|
|
/**
|
2015-03-12 11:20:00 +01:00
|
|
|
* Bulk deletes an array of objects in the type.
|
2011-06-07 20:13:34 +02:00
|
|
|
*
|
2013-03-02 12:23:44 +01:00
|
|
|
* @param array $objects array of domain model objects
|
2014-01-23 17:20:11 +01:00
|
|
|
*/
|
2015-03-12 11:20:00 +01:00
|
|
|
public function deleteMany(array $objects);
|
2014-03-29 23:36:06 +01:00
|
|
|
|
|
|
|
/**
|
2015-03-12 11:20:00 +01:00
|
|
|
* Bulk deletes records from an array of identifiers.
|
2014-03-29 23:36:06 +01:00
|
|
|
*
|
|
|
|
* @param array $identifiers array of domain model object identifiers
|
|
|
|
*/
|
|
|
|
public function deleteManyByIdentifiers(array $identifiers);
|
2014-09-21 12:06:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the object persister handles the given object.
|
|
|
|
*
|
|
|
|
* @param object $object
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function handlesObject($object);
|
2011-06-07 20:13:34 +02:00
|
|
|
}
|