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

Few questions about framework

I ve went through most of the doc, but there are some things that are unclear to me, and worries me a bit. would be nice to clear this up.

Does phalcon read in all models files while instancing? or is there a way to register only needed model? (based on controler or some custom service)? Seems I couldnt find any specyfic info on that subject.

Also for controllers, anyway to get subdirectories? to get for example uri like this /subdir/controler/method/arg ?



98.9k

Normally, a Phalcon application use an autoloader to dynamically load controllers/models/components just in time (when they are being used).

https://github.com/phalcon/vokuro/blob/master/app/config/loader.php#L8

Locations where models or controllers are placed are defined by the developer and they do not correspond to a specific location determined by the framework. You can place them wherever you want.



465

From what i understood u set this in bootstrap, right?. my question about model is when you have a big application with big number of models files (are just large ones). All example show just creating "new model()" in controller which suggest that if there many they are all loaded to mem, or arent they? Sorry for stupid question, i m trying to grasp how does it works so i can plan future work ;]



43.9k

Hi, I was asking myself the same questions. For another reason I made some step by step debug of phalcon's execution scripts with Netbeans. And I saw that models are, as Phalcon says, loaded on demand.



465

yeah, did some benchmark yesterday, seems like nothing is appended till its called. Really nice feature :D (but doc could be more clear on that)