コード例 #1
0
 /**
  * @param DataObjectInterface $object
  */
 protected function storeInCache(DataObjectInterface $object)
 {
     $this->cache->save($this->getCacheKey($object->getId()), $object->getData(), $this->getCacheLifetime());
 }
コード例 #2
0
ファイル: ObjectRepository.php プロジェクト: thewunder/corma
 /**
  * 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;
 }