dpi / rng

RNG is a Drupal module enabling people to register for events.
https://www.drupal.org/project/rng
GNU General Public License v2.0
15 stars 23 forks source link

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

Open steveoliver opened 7 years ago

steveoliver commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

freelock commented 4 years ago

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