Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita8b1a95

Browse files
committed
Add allow some extra properties
1 parentd21a434 commita8b1a95

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎src/Lodash/Http/Requests/RestrictsExtraAttributes.php‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
usefunctionapp;
1212
usefunctionarray_diff;
1313
usefunctionarray_keys;
14+
usefunctionarray_search;
1415
usefunctionconfig;
1516
usefunctionin_array;
1617
usefunctionmethod_exists;
@@ -22,6 +23,7 @@
2223
trait RestrictsExtraAttributes
2324
{
2425
protectedbool$checkForExtraProperties =true;
26+
protectedarray$ignoreExtraProperties = [];
2527
protectedbool$checkForEmptyPayload =true;
2628
protectedarray$methodsForEmptyPayload = ['PATCH','POST','PUT'];
2729

@@ -53,8 +55,19 @@ private function checkForNotAllowedProperties(): void
5355
return;
5456
}
5557

58+
$validationData =$this->getValidationData();
59+
60+
// Ignore marked properties
61+
if (!empty($this->ignoreExtraProperties)) {
62+
foreach ($this->ignoreExtraPropertiesas$deleleValue) {
63+
if (($key =array_search($deleleValue,$validationData)) !==false) {
64+
unset($validationData[$key]);
65+
}
66+
}
67+
}
68+
5669
$extraAttributes =array_diff(
57-
$this->getValidationData(),
70+
$validationData,
5871
$this->getAllowedAttributes(),
5972
);
6073

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp