To fix:
Line ui_patterns/src/Entity/UiPatternsSampleEntityGenerator.php
57 Access to an undefined property
Drupal\Core\Entity\FieldableEntityInterface::$in_preview.
đź’ˇ Learn more:
https://phpstan.org/blog/solving-phpstan-access-to-undefined-property Also, we may need to do something about this UiPatternsSampleEntityGenerator and its interface. Is it really a generator? Why "sample"? Can we implement an existing interface?
Issue fork ui_patterns-3438952
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
christian.wiedemann commentedThe variable is only available for Nodes. Right now I don't see any usecase to set the node to preview mode. I think we can remove it safely.
If we found a case we should readd it and add a typecheck for nodes. (I think Layout Builder will hit the same phpstan exception)
Comment #5
pdureau commentedProposals:
We duplicated SampleEntityGeneratorInterface from layout_builder module, so:
UiPatternsSampleEntityGenerator:
Comment #6
pdureau commentedComment #7
christian.wiedemann commentedComment #8
pdureau commentedthanks Christian for the update. It is 99% perfect.
Is it relevant to add the type of the parameters here?
public function get($entity_type_id, $bundle_id): EntityInterface;and here?
public function delete($entity_type_id, $bundle_id) :SampleEntityGeneratorInterface;Did you run?
What does "successor" means here?
Generates a sample entity for use by the UI Patterns successors.Can you rebase your MR?
Comment #9
christian.wiedemann commentedHi, I updated the types and the docs.
Comment #10
christian.wiedemann commentedComment #12
pdureau commentedComment #13
pdureau commented