Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/1154 parent mapping improvements #1240

Merged
merged 3 commits into from
Mar 7, 2023

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Feb 15, 2023

Description

Problem 1:

  • I have 2 sections: section1 and section2,
  • in the section1 section, I have:
    • entry with title: “Year 1”; slug: “year-1”
    • subentry with title “Competition 1”; slug “competition-1”
    • subentry with title “Competition 2”; slug “competition-2”
  • in the section2 section, I have:
    • entry with title: “Year 1”; slug: “year-1”
    • subentry with title “Competition 1”; slug “competition-1”
    • subentry with title “Competition 2”; slug “competition-2”
  • section 1 feed maps title, doesn’t map the slug, maps the parent based on “Title” and has “Create entries if they do not exist” checked
  • if I run the section 1 feed once section 2 data is in, I get the There was a problem getting the parent element. - Structures.php: 315 error.

Fix: This happens because searching for a parent is not limited to the entries section or category group we’re importing to. The fix is to limit searching for an existing parent within the section/group we’re importing to.

Problem 2:

  • have an entry feed that maps the title and the parent and has “Create entries if they do not exist” checked
  • data to import is:
{
	"entries": [
		{
			"name": "Competition 3",
			"parent": "Year 3"
		},
		{
			"name": "Competition 4",
			"parent": "Year 3"
		}
	]
}
  • “Year 3” entry doesn’t exist - meaning it will be created on import
  • parent entry is created correctly, but it’s not assigned to the element that triggered its creation - “Competition 3” in this case. It is assigned correctly to further elements, like “Competition 4”

Fix: Fixed by ensuring the newParentId has a value of the newly created entry assigned to it.

Problem 3:
It was possible to select a default parent for a category import from any group.

Fix: Limit categories showing in the Default value column for Parent to just the group we’re importing to.

Related issues

#1154

@i-just i-just requested a review from angrybrad as a code owner February 15, 2023 09:07
@angrybrad angrybrad merged commit 4106192 into v4 Mar 7, 2023
@angrybrad angrybrad deleted the bugfix/1154-parent-mapping-improvements branch March 7, 2023 03:48
angrybrad added a commit that referenced this pull request Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants