protected function savePrices(EntityInterface $entity) { if ($entity->getPrice() <= 0 || !$entity->getPriceDate()) { return; } $rel = new Table\BrandsPricesRel(); $row = $rel->fetchRow(array('brandId = ?' => $entity->getId(), 'price = ?' => $entity->getPrice(), 'date = ?' => $entity->getPriceDate())); try { if ($row === \null) { $row = $rel->createRow(array('brandId' => $entity->getId(), 'price' => $entity->getPrice(), 'date' => $entity->getPriceDate())); } $row->comment = $entity->getPriceComment(); $row->save(); } catch (\Exception $e) { } }