Problem/Motivation

Menu link content entities can not be stubbed (menu_name can't be null) so we need to make sure the parents come first.

Proposed resolution

Order the source by depth.

CommentFileSizeAuthor
menulinkorder_testonly.patch2.07 KBchx
menulinkorder_fix.patch2.63 KBchx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

Title: menu_name in menu link migration is broken » menu link migration needs parent first ordering
chx’s picture

Title: menu link migration needs parent first ordering » menu link stubbing fails because fields are NOT NULL
Status: Needs review » Postponed

The test change should be committed but the fix shouldn't after #2232477: Fatal when adding new fields with NOT NULL constraints in a base table that contains existing entities. We have a similar problem with taxonomy but that can't be depth ordered and that suffers the same problem so a bigger fix is needed and that is that: abolish NOT NULL in the base table.

eliza411’s picture

I know we're looking a different direction for a fix here, so please disregard this if it's not helpful. I was continuing to test menu link migrations with menulinkorder_fix.patch. The migration seems to succeed, no errors thrown, but any migrated menu with a second layer of depth (or more) displays the Drupal error screen, and the log files say:

Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Routing\RouteProvider->getRoutesByNames() (line 189 of /var/www/tag1eight/drupal/core/lib/Drupal/Core/Routing/RouteProvider.php).
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 149 of /var/www/tag1eight/drupal/core/lib/Drupal/Core/Routing/RouteProvider.php).

Word of warning, if you place the menu without checking, the site give one of these:

If you have just changed code (for example deployed a new module or moved an existing one) read http://drupal.org/documentation/rebuild

None of the tips (deleting files/php content, clearing cache etc.) helped, so I started over.

benjy’s picture

Status: Postponed » Active

Now #2232477: Fatal when adding new fields with NOT NULL constraints in a base table that contains existing entities has been committed do we just need a test? I can't actually see what changed in the test only patch?

mikeryan’s picture

Status: Active » Closed (won't fix)

This seems obsolete - the field patch was committed long ago, plus the query is now ordered by depth as the original resolution suggested. And, like benjy, I've looked at the test diffs up and down and cannot see the difference.