Skip to content
This repository was archived by the owner on Feb 23, 2020. It is now read-only.

Event type machine names exceed the 32 character limit imposed by entity reference #143

Open
steveoliver opened this issue Jun 22, 2017 · 4 comments

Comments

@steveoliver
Copy link

steveoliver commented Jun 22, 2017

Currently, when creating an event type based on a Commerce Product type I have, I end up with a Event type machine name of 42 characters.

This is because RNG creates a two-part ID for event types in the format "{entity_type}.{bundle}".

But the 'entity_reference' field schema limits the 'type' field of RNG's Registration entity to 32 characters, producing a fatal error Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'type' at row 1: INSERT INTO {registration} (vid, type, uuid, langco ...

Also, Dynamic Entity Reference also imposes the same 32-character limit on the Registration 'event' field.

Looks like we need to limit the machine name of registration types to 32 characters. :/

@steveoliver steveoliver changed the title Registration type machine names exceed the 32 character limit imposed by entity reference Event type machine names exceed the 32 character limit imposed by entity reference Jun 26, 2017
@steveoliver
Copy link
Author

See failing test in PR #144

`
Drupal\Tests\rng\Kernel\RngRegistrationEntityTest::testLongEventTypeRegistration

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data,

right truncated: 1406 Data too long for column 'type' at row 1: INSERT INTO

{registration} (vid, type, uuid, langcode) VALUES

(:db_insert_placeholder_0, :db_insert_placeholder_1,

:db_insert_placeholder_2, :db_insert_placeholder_3); Array

(

    [:db_insert_placeholder_0] => 

    [:db_insert_placeholder_1] => entity_test.event_type_over_32_characters

    [:db_insert_placeholder_2] => 41703d31-89b7-45fa-b51e-3baa76d425a5

    [:db_insert_placeholder_3] => en

)

`

@steveoliver
Copy link
Author

steveoliver commented Jun 26, 2017

I'm not sure what to propose here since RNG depends on Core's entity_reference and Dynamic Entity Reference contrib module, both of which impose the 32-character db column length limit.

Flag module, having no external dependencies like this, was able to handle the same exact issue -- lengths of db columns for entity and bundle names are too short.

In fact, there are several different situations in Core and contrib where this limitation has been dealt with -- see https://www.drupal.org/node/1709960.

steveoliver added a commit to steveoliver/rng that referenced this issue Jun 26, 2017
@steveoliver
Copy link
Author

My solution is going to be to make sure the combination of my 'entity_type.entity_bundle' does not exceed 32 characters. :/

@freelock
Copy link

Not sure how to handle this best yet -- I would like to move the issue queue back to Drupal.org, rather than having fragmented issue queues across different accounts...

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

No branches or pull requests

2 participants