From 005b42d131bd1c39af583a25e93abfbb45437dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20K=C3=BChl?= Date: Fri, 7 Feb 2025 11:47:18 +0100 Subject: [PATCH] enabled has_many processing for test models --- test/models/author.hpp | 7 +++---- test/models/recipe.hpp | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/models/author.hpp b/test/models/author.hpp index a899999..e947d54 100644 --- a/test/models/author.hpp +++ b/test/models/author.hpp @@ -19,11 +19,10 @@ struct author { std::string date_of_birth; unsigned short year_of_birth{}; bool distinguished{false}; - std::vector> books; + std::vector> books; template - 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); } }; diff --git a/test/models/recipe.hpp b/test/models/recipe.hpp index ef8f09b..a832a4d 100644 --- a/test/models/recipe.hpp +++ b/test/models/recipe.hpp @@ -16,14 +16,14 @@ struct ingredient { unsigned int id{}; std::string name; - std::vector> recipes; + std::vector> recipes; template 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> ingredients; + std::vector> ingredients; template 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); } };