Skip to content

Commit 4a673af

Browse files
Rename mapping from parent to parentId
The attribute `parentId` is used in Craft to signify the value of the parent element, if any. Therefore, the mapping handle should also be `parentId`. This patch changes the mapping handle from `parent` into `parentId`. This allows the comparison code to properly verify that an existing parent already exists. Without this patch the current comparison will use the `parent` property that does not exist in a Craft entry. This should have been `parentId` which does exist. Note that this patch is *not* backwards compatible, all imports that have been configured with a parent using handle `parent` must reconfigure the parent so it uses the renamed handle `parentId`. Perhaps it is worth the time to create a migration for this?
1 parent eaac8e3 commit 4a673af

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/elements/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function afterSave($data, $settings): void
132132
* @throws ElementNotFoundException
133133
* @throws Exception
134134
*/
135-
protected function parseParent($feedData, $fieldInfo): ?int
135+
protected function parseParentId($feedData, $fieldInfo): ?int
136136
{
137137
$value = $this->fetchSimpleValue($feedData, $fieldInfo);
138138
$default = DataHelper::fetchDefaultArrayValue($fieldInfo);

src/elements/Entry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ protected function parseExpiryDate($feedData, $fieldInfo): DateTime|bool|array|C
224224
* @throws ElementNotFoundException
225225
* @throws Exception
226226
*/
227-
protected function parseParent($feedData, $fieldInfo): ?int
227+
protected function parseParentId($feedData, $fieldInfo): ?int
228228
{
229229
$value = $this->fetchSimpleValue($feedData, $fieldInfo);
230230
$default = DataHelper::fetchDefaultArrayValue($fieldInfo);

src/templates/_includes/elements/categories/map.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}, {
2424
type: 'categories',
2525
name: 'Parent',
26-
handle: 'parent',
26+
handle: 'parentId',
2727
instructions: 'Select a parent category to import these categories under.'|t('feed-me'),
2828
default: {
2929
type: 'elementselect',

src/templates/_includes/elements/entries/map.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{% set fields = fields|push({
3131
type: 'entries',
3232
name: 'Parent',
33-
handle: 'parent',
33+
handle: 'parentId',
3434
instructions: 'Select a parent entry to import these entries under.'|t('feed-me'),
3535
default: {
3636
type: 'elementselect',

0 commit comments

Comments
 (0)