renamed schema to repository
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#ifndef RELATION_COMPLETER_HPP
|
||||
#define RELATION_COMPLETER_HPP
|
||||
|
||||
#include "matador/object/internal/shadow_schema.hpp"
|
||||
#include "matador/object/internal/shadow_repository.hpp"
|
||||
#include "matador/object/many_to_many_relation.hpp"
|
||||
#include "matador/object/join_columns_collector.hpp"
|
||||
#include "matador/object/object_ptr.hpp"
|
||||
#include "matador/object/schema_node.hpp"
|
||||
#include "matador/object/repository_node.hpp"
|
||||
|
||||
#include "matador/logger/log_manager.hpp"
|
||||
|
||||
@@ -94,13 +94,13 @@ private:
|
||||
template<typename Type>
|
||||
class relation_completer final {
|
||||
private:
|
||||
using node_ptr = std::shared_ptr<schema_node>;
|
||||
using node_ptr = std::shared_ptr<repository_node>;
|
||||
|
||||
public:
|
||||
using endpoint_ptr = std::shared_ptr<relation_endpoint>;
|
||||
|
||||
static void complete(const std::shared_ptr<schema_node> &node) {
|
||||
internal::shadow_schema shadow(node->schema_);
|
||||
static void complete(const std::shared_ptr<repository_node> &node) {
|
||||
internal::shadow_repository shadow(node->repo_);
|
||||
relation_completer completer(shadow);
|
||||
|
||||
completer.complete_node_relations(node);
|
||||
@@ -130,12 +130,12 @@ public:
|
||||
void on_has_many_to_many(const char *id, CollectionType &collection, const utils::foreign_attributes &attr);
|
||||
|
||||
private:
|
||||
explicit relation_completer(internal::shadow_schema &shadow)
|
||||
explicit relation_completer(internal::shadow_repository &shadow)
|
||||
: schema_(shadow)
|
||||
, log_(logger::create_logger("relation_completer")) {
|
||||
}
|
||||
|
||||
void complete_node_relations(const std::shared_ptr<schema_node> &node) {
|
||||
void complete_node_relations(const std::shared_ptr<repository_node> &node) {
|
||||
nodes_.push(node);
|
||||
|
||||
Type obj;
|
||||
@@ -150,7 +150,7 @@ private:
|
||||
|
||||
private:
|
||||
std::stack<node_ptr> nodes_;
|
||||
internal::shadow_schema &schema_;
|
||||
internal::shadow_repository &schema_;
|
||||
logger::logger log_;
|
||||
join_columns_collector join_columns_collector_{};
|
||||
};
|
||||
@@ -192,8 +192,8 @@ void relation_completer<Type>::on_has_many(const char *id, CollectionType &,
|
||||
// belongs-to relation handles this relation, the many-to-many
|
||||
// relation is maybe detached.
|
||||
log_.debug("node '%s' has has many foreign keys '%s' mapped by '%s'", nodes_.top()->name().c_str(), id, join_column);
|
||||
result = schema_node::make_relation_node<relation_value_type>(
|
||||
schema_.schema(), id, [join_column] {
|
||||
result = repository_node::make_relation_node<relation_value_type>(
|
||||
schema_.repo(), id, [join_column] {
|
||||
return std::make_unique<relation_value_type>("id", join_column);
|
||||
});
|
||||
if (!result) {
|
||||
@@ -220,8 +220,8 @@ void relation_completer<Type>::on_has_many(const char *id, CollectionType &, con
|
||||
using value_type = typename CollectionType::value_type;
|
||||
using relation_value_type = many_to_relation<Type, value_type>;
|
||||
|
||||
const auto result = schema_node::make_relation_node<relation_value_type>(
|
||||
schema_.schema(), id, [join_column] {
|
||||
const auto result = repository_node::make_relation_node<relation_value_type>(
|
||||
schema_.repo(), id, [join_column] {
|
||||
return std::make_unique<relation_value_type>(join_column, "value");
|
||||
});
|
||||
|
||||
@@ -263,7 +263,7 @@ void relation_completer<Type>::on_has_many_to_many(const char *id,
|
||||
return std::make_unique<relation_value_type>(join_column, inverse_join_column);
|
||||
};
|
||||
|
||||
result = schema_node::make_relation_node<relation_value_type>(schema_.schema(), id, std::move(creator));
|
||||
result = repository_node::make_relation_node<relation_value_type>(schema_.repo(), id, std::move(creator));
|
||||
if (!result) {
|
||||
// Todo: throw internal error
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user