mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-06 10:59:31 -06:00
renamed method to detachAll(bool)
To avoid unwanted overload resolution because of int to bool conversion. - also updated docs
This commit is contained in:
@@ -1229,7 +1229,7 @@ Sometimes it may be necessary to remove a role from a user. To remove a many-to-
|
||||
user->roles()->detach(roleId);
|
||||
|
||||
// Detach all roles from the user...
|
||||
user->roles()->detach();
|
||||
user->roles()->detachAll();
|
||||
|
||||
For convenience, `attach` and `detach` also accept vectors of IDs or Model instances as input:
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ namespace Concerns
|
||||
|
||||
/*! Detach models from the relationship. */
|
||||
inline int detach(const QVector<QVariant> &ids, bool touch = true) const;
|
||||
/*! Detach models from the relationship. */
|
||||
inline int detach(bool touch = true) const;
|
||||
/*! Detach all models from the relationship. */
|
||||
inline int detachAll(bool touch = true) const;
|
||||
/*! Detach models from the relationship. */
|
||||
inline int detach(const QVector<std::reference_wrapper<Related>> &models,
|
||||
bool touch = true) const;
|
||||
@@ -523,7 +523,7 @@ namespace Concerns
|
||||
|
||||
template<class Model, class Related, class PivotType>
|
||||
int
|
||||
InteractsWithPivotTable<Model, Related, PivotType>::detach(const bool touch) const
|
||||
InteractsWithPivotTable<Model, Related, PivotType>::detachAll(const bool touch) const
|
||||
{
|
||||
return detach(true, {}, touch);
|
||||
}
|
||||
|
||||
@@ -2024,7 +2024,7 @@ void tst_Relations_Inserting_Updating::detach_BasicPivot_All() const
|
||||
QCOMPARE(tagged["active"].value(), QVariant(false));
|
||||
}
|
||||
|
||||
auto affected = tag5->torrents()->detach(false);
|
||||
auto affected = tag5->torrents()->detachAll(false);
|
||||
|
||||
QCOMPARE(affected, 2);
|
||||
|
||||
@@ -2192,7 +2192,7 @@ void tst_Relations_Inserting_Updating::detach_CustomPivot_All() const
|
||||
QCOMPARE(tagged["active"].value(), QVariant(false));
|
||||
}
|
||||
|
||||
auto affected = torrent5->tags()->detach(false);
|
||||
auto affected = torrent5->tags()->detachAll(false);
|
||||
|
||||
QCOMPARE(affected, 2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user