diff --git a/docs/tinyorm-relationships.md b/docs/tinyorm-relationships.md index 45413d9a5..f670e550f 100644 --- a/docs/tinyorm-relationships.md +++ b/docs/tinyorm-relationships.md @@ -50,11 +50,10 @@ Before you start defining relationship methods, you have to declare a model clas class User final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the phone associated with the user. */ std::unique_ptr> phone() @@ -103,11 +102,10 @@ A one-to-one relationship is a very basic type of database relationship. For exa class User final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the phone associated with the user. */ std::unique_ptr> phone() @@ -160,11 +158,10 @@ So, we can access the `Phone` model from our `User` model. Next, let's define a class Phone final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the user that owns the phone. */ std::unique_ptr> user() @@ -238,11 +235,10 @@ A one-to-many relationship is used to define relationships where a single model class Post final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the comments for the blog post. */ std::unique_ptr> comments() @@ -307,11 +303,10 @@ Now that we can access all of a post's comments, let's define a relationship to class Comment final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the post that owns the comment. */ std::unique_ptr> post() @@ -397,11 +392,10 @@ For example, imagine a blog application in which a `User` model has many associa class User final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get all of the posts for the user. */ std::unique_ptr> posts() @@ -517,11 +511,10 @@ When accessing TinyORM relationships by BaseModel's `getRelationValue` method, t class Book final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the author that wrote the book. */ std::unique_ptr> author() @@ -598,11 +591,10 @@ Sometimes you might want to always load some relationships when retrieving a mod class Book final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the author that wrote the book. */ std::unique_ptr> author() @@ -677,11 +669,10 @@ For example, when a `Comment` model is updated, you may want to automatically "t class Comment final : public BaseModel { - public: friend BaseModel; - using BaseModel::BaseModel; + public: /*! Get the post that owns the comment. */ std::unique_ptr> post() diff --git a/docs/tinyorm.md b/docs/tinyorm.md index ba8c47fa3..1dbc81174 100644 --- a/docs/tinyorm.md +++ b/docs/tinyorm.md @@ -35,7 +35,6 @@ Let's examine a basic model class and discuss some of TinyORM's key conventions: class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; @@ -54,7 +53,6 @@ If your model's corresponding database table does not fit this convention, you m class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; @@ -72,7 +70,6 @@ TinyORM will also assume that each model's corresponding database table has a pr class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; @@ -87,7 +84,6 @@ In addition, TinyORM assumes that the primary key is an incrementing integer val class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; @@ -112,7 +108,6 @@ By default, TinyOrm expects `created_at` and `updated_at` columns to exist on yo class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; @@ -127,7 +122,6 @@ If you need to customize the format of your model's timestamps, set the private class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; @@ -142,7 +136,6 @@ If you need to customize the names of the columns used to store the timestamps, class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; @@ -164,7 +157,6 @@ By default, all TinyOrm models will use the default database connection that is class Flight final : public Orm::Tiny::BaseModel { - public: friend BaseModel; using BaseModel::BaseModel; diff --git a/tests/auto/functional/orm/tiny/models/models/filepropertyproperty.hpp b/tests/auto/functional/orm/tiny/models/models/filepropertyproperty.hpp index 7c6d6b2ac..a3a7ce522 100644 --- a/tests/auto/functional/orm/tiny/models/models/filepropertyproperty.hpp +++ b/tests/auto/functional/orm/tiny/models/models/filepropertyproperty.hpp @@ -8,11 +8,10 @@ class FilePropertyProperty final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the previewable file that owns the file property. */ std::unique_ptr< Orm::Tiny::Relations::Relation> diff --git a/tests/auto/functional/orm/tiny/models/models/setting.hpp b/tests/auto/functional/orm/tiny/models/models/setting.hpp index 2956bf7c7..a15991015 100644 --- a/tests/auto/functional/orm/tiny/models/models/setting.hpp +++ b/tests/auto/functional/orm/tiny/models/models/setting.hpp @@ -5,9 +5,7 @@ class Setting final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; private: diff --git a/tests/auto/functional/orm/tiny/models/models/tag.hpp b/tests/auto/functional/orm/tiny/models/models/tag.hpp index 533601c98..6acdebd30 100644 --- a/tests/auto/functional/orm/tiny/models/models/tag.hpp +++ b/tests/auto/functional/orm/tiny/models/models/tag.hpp @@ -16,11 +16,10 @@ using Orm::WithItem; class Tag final : public Orm::Tiny::BaseModel //class Tag final : public BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get torrents that belong to the tag. */ std::unique_ptr> torrents() diff --git a/tests/auto/functional/orm/tiny/models/models/tagged.hpp b/tests/auto/functional/orm/tiny/models/models/tagged.hpp index e6e8b2e06..76354820b 100644 --- a/tests/auto/functional/orm/tiny/models/models/tagged.hpp +++ b/tests/auto/functional/orm/tiny/models/models/tagged.hpp @@ -7,13 +7,11 @@ using Orm::Tiny::Relations::BasePivot; class Tagged final : public BasePivot { -public: friend BaseModel; friend BasePivot; using BasePivot::BasePivot; -private: // TODO add belongsToMany overload, which will not take table argument and obtains a table name from Model::getTable, Eloquent is doing this in the BelongsToMany::resolveTableName() method silverqx /*! Indicates if the ID is auto-incrementing. */ // bool u_incrementing = true; diff --git a/tests/auto/functional/orm/tiny/models/models/tagproperty.hpp b/tests/auto/functional/orm/tiny/models/models/tagproperty.hpp index 78d65b470..9929cca8e 100644 --- a/tests/auto/functional/orm/tiny/models/models/tagproperty.hpp +++ b/tests/auto/functional/orm/tiny/models/models/tagproperty.hpp @@ -7,12 +7,9 @@ using Orm::Tiny::BaseModel; class TagProperty final : public BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; -private: /*! The table associated with the model. */ QString u_table {"tag_properties"}; diff --git a/tests/auto/functional/orm/tiny/models/models/torrent.hpp b/tests/auto/functional/orm/tiny/models/models/torrent.hpp index c78b49ea5..c5e64b7f6 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrent.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrent.hpp @@ -23,13 +23,13 @@ class Torrent final : public BaseModel // public BaseModel { -public: friend BaseModel; + using BaseModel::BaseModel; +public: /*! The "type" of the primary key ID. */ using KeyType = quint64; - using BaseModel::BaseModel; // explicit Torrent(const QVector &attributes = {}); /*! Get the previewable files associated with the torrent. */ diff --git a/tests/auto/functional/orm/tiny/models/models/torrenteager.hpp b/tests/auto/functional/orm/tiny/models/models/torrenteager.hpp index a90be14f0..e3a340e33 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrenteager.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrenteager.hpp @@ -12,11 +12,10 @@ class TorrentEager final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the previewable files associated with the torrent. */ std::unique_ptr< Orm::Tiny::Relations::Relation> diff --git a/tests/auto/functional/orm/tiny/models/models/torrenteager_failed.hpp b/tests/auto/functional/orm/tiny/models/models/torrenteager_failed.hpp index 0b6c90c48..dd18e3673 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrenteager_failed.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrenteager_failed.hpp @@ -10,11 +10,10 @@ class TorrentEager_Failed final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the previewable files associated with the torrent. */ std::unique_ptr< Orm::Tiny::Relations::Relation> diff --git a/tests/auto/functional/orm/tiny/models/models/torrentpeer.hpp b/tests/auto/functional/orm/tiny/models/models/torrentpeer.hpp index 6a976798f..0e69a14f7 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrentpeer.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrentpeer.hpp @@ -7,11 +7,10 @@ class TorrentPeer final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the torrent that owns the torrent peer. */ std::unique_ptr< Orm::Tiny::Relations::Relation> diff --git a/tests/auto/functional/orm/tiny/models/models/torrentpeereager.hpp b/tests/auto/functional/orm/tiny/models/models/torrentpeereager.hpp index 9d74ce4d9..417d8e7c9 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrentpeereager.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrentpeereager.hpp @@ -8,11 +8,10 @@ class TorrentPeerEager final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the torrent that owns the torrent peer. */ std::unique_ptr< Orm::Tiny::Relations::Relation> diff --git a/tests/auto/functional/orm/tiny/models/models/torrentpeereager_norelations.hpp b/tests/auto/functional/orm/tiny/models/models/torrentpeereager_norelations.hpp index 91ff82d8e..050da1e61 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrentpeereager_norelations.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrentpeereager_norelations.hpp @@ -6,12 +6,9 @@ class TorrentPeerEager_NoRelations final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; -private: /*! The table associated with the model. */ QString u_table {"torrent_peers"}; diff --git a/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefile.hpp b/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefile.hpp index 9572c84ed..3cbe6ad07 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefile.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefile.hpp @@ -10,11 +10,10 @@ class TorrentPreviewableFile final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the torrent that owns the previewable file. */ std::unique_ptr< Orm::Tiny::Relations::Relation> diff --git a/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefileeager.hpp b/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefileeager.hpp index 60707ca13..3f3b01718 100644 --- a/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefileeager.hpp +++ b/tests/auto/functional/orm/tiny/models/models/torrentpreviewablefileeager.hpp @@ -9,11 +9,10 @@ class TorrentPreviewableFileEager final : public Orm::Tiny::BaseModel { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the file property associated with the previewable file. */ std::unique_ptr< Orm::Tiny::Relations::Relation { -public: friend BaseModel; - using BaseModel::BaseModel; +public: /*! Get the previewable file that owns the file property. */ std::unique_ptr< Orm::Tiny::Relations::Relation { -public: friend BaseModel; - using BaseModel::BaseModel; -private: /*! The table associated with the model. */ QString u_table {"torrent_previewable_file_properties"};