We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Models

is there any way to list all of the Modals that i have created ?



93.7k
Accepted
answer

Doubt there is framework who has such functionality without preregistering the models or autoloading them.

However a quick and not so dirty solution would be something like:

$dir = 'path-to-your-models-folder';
foreach (array_diff(scandir($dir), ['.', '..']) as $file) {
    echo $file, '<br/>';
}

// Outputs (in sample project of mine)
AdminLogs.php
AdminUsers.php
BaseModel.php
Campaigns.php
FormRequests.php
Redirects.php
Settings.php
SettingsI18n.php
Translations.php
TranslationsI18n.php
Uploads.php
UploadsI18n.php
....
....
....

And you can always get rid of the .php extension easily :)