enabled has many relations and removed obsolete namespaces
This commit is contained in:
@@ -17,7 +17,7 @@ struct course;
|
||||
struct student {
|
||||
unsigned int id{};
|
||||
std::string name;
|
||||
std::vector<matador::object::object_ptr<course>> courses;
|
||||
std::vector<object::object_ptr<course>> courses;
|
||||
|
||||
student() = default;
|
||||
explicit student(unsigned int id, std::string name)
|
||||
@@ -29,7 +29,7 @@ struct student {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "name", name, 255);
|
||||
// field::has_many_to_many(op, "student_courses", courses, "student_id", "course_id", utils::fetch_type::LAZY);
|
||||
field::has_many_to_many(op, "student_courses", courses, "student_id", "course_id", utils::fetch_type::LAZY);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -37,7 +37,7 @@ struct student {
|
||||
struct course {
|
||||
unsigned int id{};
|
||||
std::string title;
|
||||
std::vector<matador::object::object_ptr<student>> students;
|
||||
std::vector<object::object_ptr<student>> students;
|
||||
|
||||
course() = default;
|
||||
explicit course(unsigned int id, std::string title)
|
||||
@@ -49,7 +49,7 @@ struct course {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "title", title, 255);
|
||||
// field::has_many_to_many(op, "student_courses", students, utils::fetch_type::EAGER);
|
||||
field::has_many_to_many(op, "student_courses", students, utils::fetch_type::EAGER);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user