File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
src/ApiPlatform/Resources/Attribute
tests/Integration/ApiPlatform Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ class Attribute
9393 public int $ attributeGroupId ;
9494
9595 #[LocalizedValue]
96+ #[Assert \NotBlank(groups: ['Create ' ])]
9697 #[DefaultLanguage(groups: ['Create ' ], fieldName: 'names ' )]
9798 #[DefaultLanguage(groups: ['Update ' ], fieldName: 'names ' , allowNull: true )]
9899 #[Assert \All(constraints: [
@@ -108,16 +109,14 @@ class Attribute
108109 #[Assert \NotBlank(allowNull: true )]
109110 public array $ shopIds ;
110111
111- public int $ position ;
112-
113112 public const QUERY_MAPPING = [
114113 '[localizedNames] ' => '[names] ' ,
115114 '[name] ' => '[names] ' ,
116115 '[associatedShopIds] ' => '[shopIds] ' ,
117116 ];
118117
119118 public const CREATE_COMMAND_MAPPING = [
120- '[names] ' => '[localizedValue ] ' ,
119+ '[names] ' => '[localizedNames ] ' ,
121120 '[shopIds] ' => '[associatedShopIds] ' ,
122121 ];
123122
Original file line number Diff line number Diff line change @@ -131,7 +131,13 @@ public function testPartialUpdateContact(int $contactId): int
131131 $ updatedContact = $ this ->partialUpdateItem ('/contacts/ ' . $ contactId , $ patchData , ['contact_write ' ]);
132132 $ this ->assertSame ($ patchData ['names ' ], $ updatedContact ['names ' ]);
133133 $ this ->assertSame ($ patchData ['email ' ], $ updatedContact ['email ' ]);
134- $ this ->assertSame ((bool ) $ patchData ['messagesSavingEnabled ' ], (bool ) $ updatedContact ['messagesSavingEnabled ' ]);
134+
135+ // We check that when we GET the item it is updated as expected
136+ $ contact = $ this ->getItem ('/contacts/ ' . $ contactId , ['contact_read ' ]);
137+ $ this ->assertSame ($ patchData ['names ' ], $ contact ['names ' ]);
138+ $ this ->assertSame ($ patchData ['email ' ], $ contact ['email ' ]);
139+ $ this ->assertArrayHasKey ('messagesSavingEnabled ' , $ contact );
140+ $ this ->assertSame ((bool ) $ patchData ['messagesSavingEnabled ' ], (bool ) $ contact ['messagesSavingEnabled ' ]);
135141
136142 return $ contactId ;
137143 }
You can’t perform that action at this time.
0 commit comments