Esempio n. 1
0
 protected function saveStatus(EntityInterface $entity)
 {
     if (!$entity->getStatusId() || !$entity->getStatusDate()) {
         return;
     }
     $rel = new Table\BrandsStatusesRel();
     $row = $rel->fetchRow(array('brandId = ?' => $entity->getId(), 'statusId = ?' => $entity->getStatusId(), 'date = ?' => $entity->getStatusDate()));
     try {
         if ($row === \null) {
             $row = $rel->createRow(array('brandId' => $entity->getId(), 'statusId' => $entity->getStatusId(), 'date' => $entity->getStatusDate()));
         }
         $row->price = $entity->getPrice();
         $row->note = $entity->getStatusNote();
         $row->save();
     } catch (\Exception $e) {
     }
     $this->fixLastStatus((int) $entity->getId());
 }
Esempio n. 2
0
 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) {
     }
 }