Skip to content
Snippets Groups Projects

Issue #2667748 by ohthehugemanatee, hctom: Allow single scalar value in...

Issue #2667748 by ohthehugemanatee, hctom: Allow single scalar value in...

Issue #2667748 by ohthehugemanatee, hctom: Allow single scalar value in EntityReferenceRevisions data type plugin

Closes #2667748

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
47 48 */
48 49 protected $id;
49 50
51 /**
52 * The entity storage service for this field's target entity type.
53 *
54 * @var \Drupal\Core\Entity\EntityStorageInterface
55 */
56 protected $entityStorage;
57
58 public function __construct($definition, $name, TypedDataInterface $parent) {
  • missing docblock. this isn't really doing DI, it just moves the code to the constructor.

    entity storages shouldn't be stored in properties like that, because this will be initialized and load stuff even if it's not actually needed, like just reading values.

    Since typed data plugins don't support DI, lets just keep the \Drupal::entityTypeManager() call inline in the two methods.

  • Please register or sign in to reply
  • 145 133 // Add the entity_reference_revisions field to article.
    146 $field_storage = FieldStorageConfig::create(array(
    147 'field_name' => 'composite_reference',
    148 'entity_type' => 'node',
    149 'type' => 'entity_reference_revisions',
    150 'settings' => array(
    151 'target_type' => 'entity_test_composite'
    152 ),
    153 ));
    154 $field_storage->save();
    155 $field = FieldConfig::create(array(
    156 'field_storage' => $field_storage,
    157 'bundle' => 'article',
    158 ));
    159 $field->save();
    134 $this->generateEntityReferenceRevisionField('node', 'entity_test_composite', 'article');
    • there is a lot of refactoring in those tests to introduce that trait with different field names. It's not really clear to me why it's done like this, that makes it much harder to review and understand what exactly changes here. I'd prefer if this just focuses on the actual new test method and just duplicate that initialization.

    • Please register or sign in to reply
    Please register or sign in to reply
    Loading