rng icon indicating copy to clipboard operation
rng copied to clipboard

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

Open steveoliver opened this issue 8 years ago • 4 comments

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 avatar Jun 22 '17 23:06 steveoliver

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 avatar Jun 26 '17 17:06 steveoliver

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 avatar Jun 26 '17 17:06 steveoliver

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

steveoliver avatar Jun 26 '17 18:06 steveoliver

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...

freelock avatar Oct 20 '19 18:10 freelock