File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -123,17 +123,24 @@ public function save(bool $validate = true, bool $delta = true): self
123
123
$ data = $ delta ? \array_diff_assoc ($ this ->data ?? [], $ this ->__data ?? []) : $ this ->data ;
124
124
125
125
if ($ this ->getId ()) {
126
- $ this ->medoo ->update ($ this ->getTable (), $ data , ['id ' => $ this ->getId ()]);
126
+ // If delta is empty, do not run query at all
127
+ if ($ data ) {
128
+ $ this ->medoo ->update ($ this ->getTable (), $ data , ['id ' => $ this ->getId ()]);
129
+ }
127
130
} else {
128
131
$ this ->medoo ->insert ($ this ->getTable (), $ data );
129
132
$ this ->setId ($ this ->medoo ->id ());
130
133
}
131
- $ this ->sentry ->breadcrumbs ->record ([
132
- 'message ' => 'Entity ' .$ this ->__getEntityName ().'::save() ' ,
133
- 'data ' => ['query ' => $ this ->medoo ->last ()],
134
- 'category ' => 'Database ' ,
135
- 'level ' => 'info ' ,
136
- ]);
134
+
135
+ // Record breadcrumb only if we had query
136
+ if ($ data || !$ this ->getId ()) {
137
+ $ this ->sentry ->breadcrumbs ->record ([
138
+ 'message ' => 'Entity ' .$ this ->__getEntityName ().'::save() ' ,
139
+ 'data ' => ['query ' => $ this ->medoo ->last ()],
140
+ 'category ' => 'Database ' ,
141
+ 'level ' => 'info ' ,
142
+ ]);
143
+ }
137
144
138
145
return $ this ;
139
146
}
You can’t perform that action at this time.
0 commit comments