PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.14
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.14
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
← All changes | app/Models/Entry.php +25 -1 6.2.26.2.14 View file →
@@ -5,8 +5,17 @@
5 5 use Exception;
6 6 use FluentForm\App\Modules\Payments\PaymentHelper;
7 7 use FluentForm\Framework\Support\Arr;
8 8
9 +/**
10 + * Legacy duplicate of the Submission model (deprecated code).
11 + *
12 + * @deprecated Dead pair with EntryMeta: they reference only each other (a circular
13 + * relation that is never invoked) plus Form. No external code in free or
14 + * Pro uses either class, and remove() has no callers. The live "Entry"
15 + * API is \FluentForm\App\Api\Entry; submissions go through Submission.
16 + * TODO: delete Entry AND EntryMeta together; remove() kept fail-closed meanwhile.
17 + */
9 18 class Entry extends Model
10 19 {
11 20 /**
12 21 * The table associated with the model.
@@ -174,10 +183,25 @@
174 183 {
175 184 $this->where('id', $id)->update($data);
176 185 }
177 186
178 - public static function remove($entryIds)
187 + public static function remove($entryIds, $formId = null)
179 188 {
189 + // Fail-closed scope guard: $formId scopes every delete to its owning form;
190 + // a missing scope throws rather than ever deleting unscoped.
191 + if (empty($formId)) {
192 + throw new \InvalidArgumentException('Entry::remove() requires a form id to scope the deletion.');
193 + }
194 +
195 + $entryIds = static::where('form_id', $formId)
196 + ->whereIn('id', (array) $entryIds)
197 + ->pluck('id')
198 + ->all();
199 +
200 + if (!$entryIds) {
201 + return;
202 + }
203 +
180 204 static::whereIn('id', $entryIds)->delete();
181 205
182 206 EntryMeta::whereIn('response_id', $entryIds)->delete();
183 207