Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add loadRevision functionality #5717

Merged
merged 2 commits into from
Jul 24, 2023
Merged

add loadRevision functionality #5717

merged 2 commits into from
Jul 24, 2023

Conversation

chx
Copy link
Contributor

@chx chx commented Jul 24, 2023

next step in the entity work is to add Paragraph::loadRevision. We can just steal the code from EntityBase::load(), wrap it in eval and boom.

2023-07-24 16 51 31

@chx chx requested a review from damiankloip as a code owner July 24, 2023 14:57
@@ -308,7 +308,14 @@ public function makeEntitiesAvailableWithShortClassNames(): void
foreach ($this->entityTypeManager->getDefinitions() as $definition) {
$class = $definition->getClass();
$parts = explode('\\', $class);
class_alias($class, array_pop($parts));
eval(sprintf('class %s extends \%s {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs code comment about what the heck we are doing. Also, can you think of a more elegant way than eval?

@weitzman weitzman merged commit 31c64d7 into drush-ops:12.x Jul 24, 2023
2 checks passed
@heddn
Copy link
Contributor

heddn commented Aug 15, 2023

I have some final entity classes. this blows up on that.

heddn added a commit to heddn/drush that referenced this pull request Aug 15, 2023
@chx
Copy link
Contributor Author

chx commented Aug 15, 2023

You drank too much of the upstream kool aid to use final classes.

@heddn
Copy link
Contributor

heddn commented Aug 15, 2023

I always use final classes for custom entities. And in the case of the example contrib config entities, I don't want to have to worry about BC with some strange use case extending my entity classes. Easier to just mark final.

@chx
Copy link
Contributor Author

chx commented Aug 15, 2023

/me shrugs

roll it back if you want, wouldn't be the first case this private and final idiocy ruins the party

I even wrote a pleading letter to php internals to give an out for readonly classes but they of course wouldn't listen

yay for theory to win over practice

weitzman pushed a commit that referenced this pull request Aug 19, 2023
* Handle final entity classs

Follow-up to #5717

* Update src/Commands/core/CliCommands.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants