/**
  * @param DataObjectInterface $object
  */
 protected function storeInCache(DataObjectInterface $object)
 {
     $this->cache->save($this->getCacheKey($object->getId()), $object->getData(), $this->getCacheLifetime());
 }
Example #2
0
 /**
  * Build parameters for insert or update
  * @param DataObjectInterface $object
  * @return array
  */
 protected function buildQueryParams(DataObjectInterface $object)
 {
     $queryParams = [];
     $dbColumns = $this->queryHelper->getDbColumns($object->getTableName());
     $data = $object->getData();
     foreach ($dbColumns as $column => $acceptNull) {
         if ($column == 'id') {
             continue;
         }
         if (isset($data[$column])) {
             $queryParams[$this->db->quoteIdentifier($column)] = $data[$column];
         } else {
             if ($acceptNull) {
                 $queryParams[$this->db->quoteIdentifier($column)] = null;
             }
         }
     }
     return $queryParams;
 }