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 model:prune console command #1263

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

Add model:prune console command #1263

wants to merge 7 commits into from

Conversation

mjauvin
Copy link
Member

@mjauvin mjauvin commented Dec 4, 2024

No description provided.

@mjauvin mjauvin added enhancement PRs that implement a new feature or substantial change needs review Issues/PRs that require a review from a maintainer labels Dec 4, 2024
@mjauvin mjauvin added this to the 1.2.8 milestone Dec 4, 2024
@mjauvin mjauvin requested a review from LukeTowers December 4, 2024 16:26
@mjauvin mjauvin self-assigned this Dec 4, 2024
$models[] = static::findCoreModels();
$models[] = static::findActivePluginsModels();

return collect($models)->flatten()->all();
Copy link
Member

Choose a reason for hiding this comment

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

Are we doing any sort of checking to make sure the classes are actual model classes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, no.

Copy link
Member Author

Choose a reason for hiding this comment

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

@LukeTowers But I do search only under /models/ folders

Copy link
Member Author

Choose a reason for hiding this comment

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

Are we doing any sort of checking to make sure the classes are actual model classes?

Any suggestions ?

Copy link
Member

Choose a reason for hiding this comment

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

@mjauvin if the intention is to find out if it's a model without loading it, you'll have to use something like PHP Parser to statically analyze the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bennothommo I think searching for all class files under models is good enough for the purpose, more logic can be added by the code using the ModelFinder helper once it gets the list of class files as this is more efficient.

@LukeTowers
Copy link
Member

@jaxwilko random thought:

This could be related to our work on the extension management refactoring where we could make it so that the extension managers could have an API for searching for specific types of classes / files under them (i.e. model classes, components, CLI commands, etc) to make these sorts of use cases easier to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs that implement a new feature or substantial change needs review Issues/PRs that require a review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants