diff --git a/include/libdnf5/transaction/transaction.hpp b/include/libdnf5/transaction/transaction.hpp index 22525656c..fd90a28f2 100644 --- a/include/libdnf5/transaction/transaction.hpp +++ b/include/libdnf5/transaction/transaction.hpp @@ -165,6 +165,9 @@ class LIBDNF_API Transaction { /// into a `libdnf5::Goal` and replayed. std::string serialize(); + /// @return A `Base` object to which the transaction belongs. + BaseWeakPtr get_base() const; + private: friend Transformer; friend libdnf5::base::Transaction; diff --git a/libdnf5/transaction/transaction.cpp b/libdnf5/transaction/transaction.cpp index 43917cbd1..a507dce9b 100644 --- a/libdnf5/transaction/transaction.cpp +++ b/libdnf5/transaction/transaction.cpp @@ -362,6 +362,10 @@ TransactionState Transaction::get_state() const noexcept { return p_impl->state; } +BaseWeakPtr Transaction::get_base() const { + return p_impl->base; +} + // Setters void Transaction::set_id(int64_t value) {