We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Model folder

Hello everyone and happy new year,

i have a new problem. I need to map all tablename to the model class. Is there a way to do this?

i thought about something like: get the registered Model folder (is that possible over the modelManager? i didnt found a method for something like that) and then just call every models getSource method.

thanks for your help pat

You could possibly get the Model directory if you set up the config in the DI. Then perhaps $this->config->phalcon->modelsDir;

https://docs.phalcon.io/en/latest/api/Phalcon_Config.html

Hope that helps a bit.

Thanks for the reply. but that would also mean that everyone who is using my plugin has to use this exact config key for the models. mine for example is called "entitiesDir"

Hope there will be a real method or something for that



43.9k

Hi,

I do not really understand. Are you dealing with a plugn or with models ?

You can use namespaces https://docs.phalcon.io/en/latest/reference/loader.html#registering-namespaces