Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Install path and type definitions. #13

Open
wants to merge 2 commits into
base: 8.x-2.x
Choose a base branch
from

Conversation

benjy
Copy link
Contributor

@benjy benjy commented Jan 18, 2016

@Berdir
Copy link
Contributor

Berdir commented Jan 18, 2016

This is apparently still failing badly for the pathauto test.

What I don't understand is why this doesn't work by default. There's a similar issue in contact_storage that I'd expect to "just work".

See ModuleInstaller::install():

foreach ($entity_manager->getDefinitions() as $entity_type) {
      if ($entity_type->getProvider() == $module) {
        $update_manager->installEntityType($entity_type);
      }
      elseif ($entity_type->isSubclassOf(FieldableEntityInterface::CLASS)) {
        // The module being installed may be adding new fields to existing
        // entity types. Field definitions for any entity type defined by
        // the module are handled in the if branch.
        foreach ($entity_manager->getFieldStorageDefinitions($entity_type->id()) as $storage_definition) {
          if ($storage_definition->getProvider() == $module) {
            // If the module being installed is also defining a storage key
            // for the entity type, the entity schema may not exist yet. It
            // will be created later in that case.
            try {
              $update_manager->installFieldStorageDefinition($storage_definition->getName(), $entity_type->id(), $module, $storage_definition);
            }
            catch (EntityStorageException $e) {
              watchdog_exception('system', $e, 'An error occurred while notifying the creation of the @name field storage definition: "!message" in %function (line %line of %file).', ['@name' => $storage_definition->getName()]);
            }
          }
        }
      }
    }

As far as I understand, the elseif case is meant to deal with exactly this. A module that adds field definition storages to an entity should have them installed automatically on install. Can you try to debug why that's not working as expected? Maybe the provider is wrong and we need to set it explictiyl to our module?

@benjy
Copy link
Contributor Author

benjy commented Jan 20, 2016

Hmm, this seems to be fixed for me. The tests pass locally and the pathauto code isn't needed in file_entity_install() with a manual test either.

@benjy
Copy link
Contributor Author

benjy commented Feb 4, 2016

I hit this again today with aGov so I still think it's an issue, also I noted a couple of issues with pathauto but I saw your comment here: https://www.drupal.org/node/2661178#comment-10818764 so i've removed that part of the code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants