public function getBarcodeHistory(RM_Barcode_object $obBarcode, $idState) { $query = M('Db')->createQuery($this->_tables['barcode_control'])->what('*')->where('barcode = ?', $obBarcode->value)->where('id <= ?', $idState)->order('id asc'); $state = M('Barcode')->control()->validate($obBarcode->props()); foreach ($query->execute() as $row) { $curstate = unserialize($row['diff']); foreach ($curstate as $key => $value) { $state[$key] = $value; } } return M('Barcode')->control()->resolveEntityNamesByIds($state); }