query/test/models/order_details.hpp

29 lines
794 B
C++

#ifndef QUERY_ORDER_DETAILS_HPP
#define QUERY_ORDER_DETAILS_HPP
#include "product.hpp"
#include "matador/object/collection.hpp"
#include "matador/object/object_ptr.hpp"
#include "matador/utils/foreign_attributes.hpp"
namespace matador::test {
struct order;
struct order_details {
unsigned int order_details_id;
object::object_ptr<order> order_;
object::collection<object::object_ptr<product>> products_;
template<class Operator>
void process(Operator &op) {
namespace field = matador::access;
field::primary_key(op, "order_details_id", order_details_id);
field::belongs_to(op, "order_id", order_, utils::CascadeNoneFetchLazy);
field::has_many(op, "order_products", products_, "product_id", utils::CascadeNoneFetchLazy);
}
};
}
#endif //QUERY_ORDER_DETAILS_HPP