From a4cec6d0d7fcdaacf721afa5cd02e3f093899601 Mon Sep 17 00:00:00 2001 From: silverqx Date: Thu, 1 Sep 2022 15:25:39 +0200 Subject: [PATCH] note about Custom Pivot models and u_xyz members --- include/orm/tiny/relations/basepivot.hpp | 16 ++++++++++++++++ tests/models/models/tagged.hpp | 15 ++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/include/orm/tiny/relations/basepivot.hpp b/include/orm/tiny/relations/basepivot.hpp index e6d78c3b1..a766497f2 100644 --- a/include/orm/tiny/relations/basepivot.hpp +++ b/include/orm/tiny/relations/basepivot.hpp @@ -128,6 +128,22 @@ namespace Orm::Tiny::Relations /* AsPivot */ + /* Custom Pivot models only: + Below is true, only during obtaining pivot records from the database during + the lazy or eager loading. + It's not true eg. if you call Tagged::create()/save()/update()/..., in all this + cases the Ignored u_xyz data members are taken into account normally❗ + + Ignored : u_connection, u_timestamps, CREATED_AT, UPDATED_AT + Accepted : u_attributes, u_dates, u_dateFormat, u_fillable, u_guarded, + u_incrementing, u_table + + Notes : u_connection - inferred from the parent model + u_timestamps - true if attributes contain both CREATED_AT and UPDATED_AT + CREATED/UPDATED_AT - inferred from the parent model, can be overriden + using the withTimestamps() method + */ + // NOTE api different, passing down a pivot timestamps data silverqx template template diff --git a/tests/models/models/tagged.hpp b/tests/models/models/tagged.hpp index 8147e81f1..2d539c59e 100644 --- a/tests/models/models/tagged.hpp +++ b/tests/models/models/tagged.hpp @@ -22,7 +22,20 @@ class Tagged final : public BasePivot /*! Indicates if the ID is auto-incrementing. */ // bool u_incrementing = true; - // FUTURE u_connection can't be overridden, the same is true in Eloquent, add support to be able to override these silveqx + /* Below is true, only during obtaining pivot records from the database during + the lazy or eager loading with the Custom Pivot models only. + It's not true eg. if you call Tagged::create()/save()/update()/..., in all this + cases the Ignored u_xyz data members are taken into account normally❗ + + Ignored : u_connection, u_timestamps, CREATED_AT, UPDATED_AT + Accepted : u_attributes, u_dates, u_dateFormat, u_fillable, u_guarded, + u_incrementing, u_table + + Notes : u_connection - inferred from the parent model + u_timestamps - true if attributes contain both CREATED_AT and UPDATED_AT + CREATED/UPDATED_AT - inferred from the parent model, can be overriden + using the withTimestamps() method + */ }; } // namespace Models