mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-03-20 06:21:06 +02:00
[#5973] fixed Record.Fresh and Record.Clone method not properly copying the record fields
This commit is contained in:
parent
bcb2dca44e
commit
51ac522e7f
@ -589,8 +589,10 @@ func (m *Record) Original() *Record {
|
|||||||
func (m *Record) Fresh() *Record {
|
func (m *Record) Fresh() *Record {
|
||||||
newRecord := m.Original()
|
newRecord := m.Original()
|
||||||
|
|
||||||
// note: this will also load the Id field though m.Get
|
// note: this will also load the Id field through m.GetRaw
|
||||||
newRecord.Load(m.FieldsData())
|
for _, field := range m.collection.Fields {
|
||||||
|
newRecord.SetRaw(field.GetName(), m.GetRaw(field.GetName()))
|
||||||
|
}
|
||||||
|
|
||||||
return newRecord
|
return newRecord
|
||||||
}
|
}
|
||||||
@ -609,7 +611,10 @@ func (m *Record) Clone() *Record {
|
|||||||
newRecord.ignoreUnchangedFields = m.ignoreUnchangedFields
|
newRecord.ignoreUnchangedFields = m.ignoreUnchangedFields
|
||||||
newRecord.customVisibility.Reset(m.customVisibility.GetAll())
|
newRecord.customVisibility.Reset(m.customVisibility.GetAll())
|
||||||
|
|
||||||
newRecord.Load(m.data.GetAll())
|
data := m.data.GetAll()
|
||||||
|
for k, v := range data {
|
||||||
|
newRecord.SetRaw(k, v)
|
||||||
|
}
|
||||||
|
|
||||||
if m.expand != nil {
|
if m.expand != nil {
|
||||||
newRecord.SetExpand(m.expand.GetAll())
|
newRecord.SetExpand(m.expand.GetAll())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user