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 function node_types_rebuild() #133

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

darrenoh
Copy link
Contributor

@darrenoh darrenoh commented Dec 7, 2023

No description provided.

Copy link
Collaborator

@mglaman mglaman left a comment

Choose a reason for hiding this comment

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

Feedback


function node_types_rebuild(): void
{
$tags = \Drupal::config('node_type')->getCacheTags();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is valid. There isn't a node_type config object.

Comment on lines +31 to +82
$tags[] = 'config:node_type_list';
Cache::invalidateTags($tags);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if this is correct. We probably want the value of getListCacheTags from the node_type entity type definition.

Comment on lines 33 to 84
$storage = \Drupal::service('config.storage');
assert($storage instanceof StorageCacheInterface);
$storage->resetListCache();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of this, we could load all node_type entities, collect their getCacheTags and use Cache::mergeTags to invalidate all of their individual cache tags.

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.

2 participants