1 | <?php |
||
26 | class ObjectPersister implements ObjectPersisterInterface |
||
27 | { |
||
28 | protected $index; |
||
29 | protected $transformer; |
||
30 | protected $objectClass; |
||
31 | protected $fields; |
||
32 | protected $logger; |
||
33 | private $options; |
||
34 | |||
35 | 16 | public function __construct(Index $index, ModelToElasticaTransformerInterface $transformer, string $objectClass, array $fields, array $options = []) |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function handlesObject($object): bool |
||
51 | |||
52 | public function setLogger(LoggerInterface $logger) |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | 7 | public function insertOne($object) |
|
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 5 | public function replaceOne($object) |
|
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | 3 | public function deleteOne($object) |
|
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function deleteById($id, $routing = false) |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | 10 | public function insertMany(array $objects) |
|
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | 5 | public function replaceMany(array $objects) |
|
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | 3 | public function deleteMany(array $objects) |
|
139 | |||
140 | /** |
||
141 | * {@inheritdoc} |
||
142 | */ |
||
143 | public function deleteManyByIdentifiers(array $identifiers, $routing = false) |
||
151 | |||
152 | /** |
||
153 | * Transforms an object to an elastica document. |
||
154 | */ |
||
155 | 6 | public function transformToElasticaDocument(object $object): Document |
|
159 | |||
160 | /** |
||
161 | * Log exception if logger defined for persister belonging to the current listener, otherwise re-throw. |
||
162 | * |
||
163 | * @throws BulkException |
||
164 | */ |
||
165 | private function log(BulkException $e) |
||
173 | } |
||
174 |