From c5871f42a5bab3372e7feb727548b4294527e948 Mon Sep 17 00:00:00 2001 From: silverqx Date: Sun, 7 Aug 2022 18:09:46 +0200 Subject: [PATCH] exposed Model/Related types on Relation classes --- include/orm/tiny/relations/belongsto.hpp | 4 +++- include/orm/tiny/relations/belongstomany.hpp | 6 +++++- include/orm/tiny/relations/hasmany.hpp | 4 +++- include/orm/tiny/relations/hasone.hpp | 4 +++- include/orm/tiny/relations/hasoneormany.hpp | 4 +++- include/orm/tiny/relations/relation.hpp | 4 +++- include/orm/tiny/relations/relationproxies.hpp | 5 +++++ 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/include/orm/tiny/relations/belongsto.hpp b/include/orm/tiny/relations/belongsto.hpp index 330675a8a..713f87482 100644 --- a/include/orm/tiny/relations/belongsto.hpp +++ b/include/orm/tiny/relations/belongsto.hpp @@ -28,7 +28,9 @@ namespace Orm::Tiny::Relations const QString &relationName); public: - /*! Related instance type passed to the relation. */ + /*! Parent Model type. */ + using ModelType = Model; + /*! Related type. */ using RelatedType = Related; /*! Virtual destructor. */ diff --git a/include/orm/tiny/relations/belongstomany.hpp b/include/orm/tiny/relations/belongstomany.hpp index f87178909..0052aaf90 100644 --- a/include/orm/tiny/relations/belongstomany.hpp +++ b/include/orm/tiny/relations/belongstomany.hpp @@ -45,8 +45,12 @@ namespace Orm::Tiny::Relations inline BelongsToMany(const BelongsToMany &) = default; public: - /*! Related instance type passed to the relation. */ + /*! Parent Model type. */ + using ModelType = Model; + /*! Related type. */ using RelatedType = Related; + /*! Pivot type. */ + using PivotTypeType = PivotType; /*! Virtual destructor. */ inline ~BelongsToMany() override = default; diff --git a/include/orm/tiny/relations/hasmany.hpp b/include/orm/tiny/relations/hasmany.hpp index ce87bb457..8316b8fc9 100644 --- a/include/orm/tiny/relations/hasmany.hpp +++ b/include/orm/tiny/relations/hasmany.hpp @@ -25,7 +25,9 @@ namespace Orm::Tiny::Relations const QString &foreignKey, const QString &localKey); public: - /*! Related instance type passed to the relation. */ + /*! Parent Model type. */ + using ModelType = Model; + /*! Related type. */ using RelatedType = Related; /*! Virtual destructor. */ diff --git a/include/orm/tiny/relations/hasone.hpp b/include/orm/tiny/relations/hasone.hpp index 24d759c2a..ebf0860ff 100644 --- a/include/orm/tiny/relations/hasone.hpp +++ b/include/orm/tiny/relations/hasone.hpp @@ -27,7 +27,9 @@ namespace Orm::Tiny::Relations const QString &foreignKey, const QString &localKey); public: - /*! Related instance type passed to the relation. */ + /*! Parent Model type. */ + using ModelType = Model; + /*! Related type. */ using RelatedType = Related; /*! Virtual destructor. */ diff --git a/include/orm/tiny/relations/hasoneormany.hpp b/include/orm/tiny/relations/hasoneormany.hpp index 019d1b6db..dfc7f4b28 100644 --- a/include/orm/tiny/relations/hasoneormany.hpp +++ b/include/orm/tiny/relations/hasoneormany.hpp @@ -28,7 +28,9 @@ namespace Orm::Tiny::Relations const QString &foreignKey, const QString &localKey); public: - /*! Related instance type passed to the relation. */ + /*! Parent Model type. */ + using ModelType = Model; + /*! Related type. */ using RelatedType = Related; /*! Pure virtual destructor. */ diff --git a/include/orm/tiny/relations/relation.hpp b/include/orm/tiny/relations/relation.hpp index ef9d04219..4d9d97cf8 100644 --- a/include/orm/tiny/relations/relation.hpp +++ b/include/orm/tiny/relations/relation.hpp @@ -48,7 +48,9 @@ namespace Relations inline Relation(const Relation &) = default; public: - /*! Related instance type passed to the relation. */ + /*! Parent Model type. */ + using ModelType = Model; + /*! Related type. */ using RelatedType = Related; /*! Pure virtual destructor. */ diff --git a/include/orm/tiny/relations/relationproxies.hpp b/include/orm/tiny/relations/relationproxies.hpp index 79a00f3b6..0c447c68d 100644 --- a/include/orm/tiny/relations/relationproxies.hpp +++ b/include/orm/tiny/relations/relationproxies.hpp @@ -39,6 +39,11 @@ namespace Tiny::Relations inline RelationProxies(const RelationProxies &) = default; public: + /*! Parent Model type. */ + using ModelType = Model; + /*! Related type. */ + using RelatedType = Related; + /*! Default constructor. */ inline RelationProxies() = default; /*! Pure virtual destructor. */