Example #1
0
 /**
  * @author KienNN
  * @param \Accounting\Model\Transaction\Item $item
  */
 public function get($item)
 {
     if (!$item->getId()) {
         return null;
     }
     $select = $this->getDbSql()->select(['i' => self::TABLE_NAME]);
     $select->where(['id' => $item->getId()]);
     $select->limit(1);
     $query = $this->getDbSql()->buildSqlString($select);
     $rows = $this->getDbAdapter()->query($query, Adapter::QUERY_MODE_EXECUTE);
     if ($rows->count()) {
         $item->exchangeArray((array) $rows->current());
         return $item;
     }
     return null;
 }