enabled has_many processing for test models
This commit is contained in:
parent
8ef78bb658
commit
005b42d131
|
|
@ -19,11 +19,10 @@ struct author {
|
|||
std::string date_of_birth;
|
||||
unsigned short year_of_birth{};
|
||||
bool distinguished{false};
|
||||
std::vector<matador::object::object_ptr<book>> books;
|
||||
std::vector<object::object_ptr<book>> books;
|
||||
|
||||
template<typename Operator>
|
||||
void process(Operator &op)
|
||||
{
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "first_name", first_name, 63);
|
||||
|
|
@ -31,7 +30,7 @@ struct author {
|
|||
field::attribute(op, "date_of_birth", date_of_birth, 31);
|
||||
field::attribute(op, "year_of_birth", year_of_birth);
|
||||
field::attribute(op, "distinguished", distinguished);
|
||||
// field::has_many(op, books, "author_id", utils::fetch_type::LAZY);
|
||||
field::has_many(op, "books", books, "author_id", utils::fetch_type::EAGER);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ struct ingredient
|
|||
{
|
||||
unsigned int id{};
|
||||
std::string name;
|
||||
std::vector<matador::object::object_ptr<recipe>> recipes;
|
||||
std::vector<object::object_ptr<recipe>> recipes;
|
||||
|
||||
template<class Operator>
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "name", name, 255);
|
||||
// field::has_many_to_many(op, "recipe_ingredients", recipes, "ingredient_id", "recipe_id", utils::fetch_type::EAGER);
|
||||
field::has_many_to_many(op, "recipe_ingredients", recipes, "ingredient_id", "recipe_id", utils::fetch_type::EAGER);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -31,14 +31,14 @@ struct recipe
|
|||
{
|
||||
unsigned int id{};
|
||||
std::string name;
|
||||
std::vector<matador::object::object_ptr<ingredient>> ingredients;
|
||||
std::vector<object::object_ptr<ingredient>> ingredients;
|
||||
|
||||
template<class Operator>
|
||||
void process(Operator &op) {
|
||||
namespace field = matador::access;
|
||||
field::primary_key(op, "id", id);
|
||||
field::attribute(op, "name", name, 255);
|
||||
// field::has_many_to_many(op, "recipe_ingredients", ingredients, utils::fetch_type::LAZY);
|
||||
field::has_many_to_many(op, "recipe_ingredients", ingredients, utils::fetch_type::LAZY);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue