I had today to iterate through the full list of models of my app and
instantiate them on the fly, and I were hit by a little problem. When
trying to load a model (using Controller::loadModel or
ClassRegistry::init) that is not linked to a table in the database
(like AppModel for example) I get an Error : Missing Table page and my
script stopped.
I had to manually exclude models I knew to not have tables in the DB,
but I was wondering if there was a cleaner way to catch the error and
not loading those models ? Basically I have the full list of models
from the Configure::listObjects('model') method and would have loved
to iterate through it and dismiss any faulty model.
I'm not very familiar with error catching and all the try/catch/
exception stuff so maybe my question is more PHP-specific than cake-
specific, but if someone can point me in the right direction, it would
be appreciated.
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment