diff --git a/include/orm/tiny/relations/basepivot.hpp b/include/orm/tiny/relations/basepivot.hpp index a37c7459c..9265c01d2 100644 --- a/include/orm/tiny/relations/basepivot.hpp +++ b/include/orm/tiny/relations/basepivot.hpp @@ -44,8 +44,6 @@ namespace Orm::Tiny::Relations fromRawAttributes(const Parent &parent, const QVector &attributes, const QString &table, bool exists = false); - /*! Set the key names for the pivot model instance. */ - PivotModel &setPivotKeys(const QString &foreignKey, const QString &relatedKey); /*! Determine if the pivot model or given attributes has timestamp attributes. */ bool hasTimestampAttributes(const QVector &attributes) const; /*! Determine if the pivot model or given attributes has timestamp attributes. */ @@ -68,6 +66,9 @@ namespace Orm::Tiny::Relations /*! Get the "related key" column name. */ const QString &getRelatedKey() const noexcept; + /*! Set the key names for the pivot model instance. */ + PivotModel &setPivotKeys(const QString &foreignKey, const QString &relatedKey); + // TODO fuckup, timestamps in pivot, the solution is to set CREATED_AT and UPDATED_AT right away in the fromAttributes method when I still have access to the parent, then I won't have to save a pointer to the parent. I can still save pointer to parent, but not for obtaining this timestamp column names. old - I will solve it when I will have to use timestamps in the code, anyway may be I will not need it, because I can pass to the method right away what I will need silverqx // TODO also don't forget unsetRelations() if pivotParent will be implemented silverqx /*! The parent model of the relationship. */ @@ -162,18 +163,6 @@ namespace Orm::Tiny::Relations return instance; } - template - PivotModel & - BasePivot::setPivotKeys(const QString &foreignKey, - const QString &relatedKey) - { - m_foreignKey = foreignKey; - - m_relatedKey = relatedKey; - - return this->model(); - } - template bool BasePivot::hasTimestampAttributes( const QVector &attributes) const @@ -255,6 +244,18 @@ namespace Orm::Tiny::Relations return m_relatedKey; } + template + PivotModel & + BasePivot::setPivotKeys(const QString &foreignKey, + const QString &relatedKey) + { + m_foreignKey = foreignKey; + + m_relatedKey = relatedKey; + + return this->model(); + } + /* protected */ /* AsPivot */