throw new WriterException('Element is not valid', 0,
$baseException);
} /** @var Value|null $valueModel */
$valueModel =
$valueRepository->
findOneBy(['shopId' =>
$shopId, 'element' =>
$element]);
if ($valueModel === null
) { if ($value ===
$parentValue ||
$value === null
) { return;
} $valueModel =
new Value();
$valueModel->
setElement($element);
$valueModel->
setShopId($shopId);
// serialize done by Doctrine
$valueModel->
setValue($value);
$this->modelManager->
persist($valueModel);
try { $this->modelManager->
flush($valueModel);
} catch (OptimisticLockException
$e) { throw new WriterException('Failed writing to database', 0,
$e);
}