Issue #2667748 by ohthehugemanatee, hctom: Allow single scalar value in...
2 open threads
Merge request reports
Activity
added 9 commits
-
a2c14629...1ed6a5a6 - 8 commits from branch
project:8.x-1.x
- 5e4ecf30 - Issue #2667748 by ohthehugemanatee, hctom: Allow single scalar value in...
-
a2c14629...1ed6a5a6 - 8 commits from branch
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.
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