Кому доводилось решать конфликты в Riak на PHP
я их решаю, но во время сохранения объекта транспорт падает с исключением:
Код:
unable to set object: <key>
Код:
$this->object = $this->bucket->get(self::HEAD_PREFIX.$this->user_id);
if ($this->object->hasSiblings()) {
$actions = array();
foreach ($this->object->getSiblings() as $sibling) {
$data = $sibling->getData();
$sibling->delete();
if (!empty($data) && is_array($data)) {
$actions = array_merge($actions, $data);
}
}
$this->object->setData($actions);
$this->object->store();
}
if ($this->object->hasSiblings()) {
$actions = array();
foreach ($this->object->getSiblings() as $sibling) {
$data = $sibling->getData();
$sibling->delete();
if (!empty($data) && is_array($data)) {
$actions = array_merge($actions, $data);
}
}
$this->object->setData($actions);
$this->object->store();
}
Код:
$this->object = $this->bucket->get(self::HEAD_PREFIX.$this->user_id);
if ($this->object->hasSiblings()) {
$actions = array();
foreach ($this->object->getSiblings() as $sibling) {
$data = $sibling->getData();
$sibling->delete();
if (!empty($data) && is_array($data)) {
$actions = array_merge($actions, $data);
}
}
$this->object->delete();
$this->object = $this->bucket->newObject($this->object->getKey(), $actions);
$this->object->store();
}
if ($this->object->hasSiblings()) {
$actions = array();
foreach ($this->object->getSiblings() as $sibling) {
$data = $sibling->getData();
$sibling->delete();
if (!empty($data) && is_array($data)) {
$actions = array_merge($actions, $data);
}
}
$this->object->delete();
$this->object = $this->bucket->newObject($this->object->getKey(), $actions);
$this->object->store();
}