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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle deleted model classes when purging tokens #7188

Open
wants to merge 1 commit into
base: 4.13
Choose a base branch
from

Conversation

richardhj
Copy link
Member

My Sentry is overflowing because of this error 馃槃

@github-actions github-actions bot added this to the 4.13 milestone May 4, 2024
@richardhj richardhj changed the title Handly deleted model classes when purging tokens Handle deleted model classes when purging tokens May 4, 2024
@aschempp
Copy link
Member

How can the class of an opt-in token be deleted? Did you remove an implementation that used opt-in tokens?

@richardhj
Copy link
Member Author

Yes, I used the OptIn service for an own implemention. That implementation does not exist anymore, but the OptIn tokens (referencing to that old implementation, table names tl_participant).

} catch (\RuntimeException $e) {
// Class does not exist anymore, token can be deleted
break;
}

/** @var Model $model */
$model = $this->framework->getAdapter($class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the error happen here rather than with $class = $adapter->getClassFromTable($table);? The latter just returns a string and should always work, even if the class does not exist anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the error log
Screenshot 2024-05-23 at 14 31 50

Copy link
Contributor

@fritzmg fritzmg May 23, 2024

Choose a reason for hiding this comment

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

But that's the stack trace for Contao 5. This PR is against 4.13 and the error would not occur in that line - it would occur later when the class is tried to be instantiated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants