Thanks for all replies. Here is what finally worked (if it might be
useful for you):

I overwrote the cakeError in app_model.php

        // if this trigger - SILENT_MODEL_ERRORS is on, 'missing db table'
error wont produce and stop your stuff
        function cakeError($error, $params)
        {
                if(defined('SILENT_MODEL_ERRORS') && SILENT_MODEL_ERRORS==true)
                        throw new Exception($error.' error in '.$this->name.' 
model');
                else
                        return parent::cakeError($error, $params);
        }

And caught exception on ClassRegistry::init() using try-catch
statements.


On Aug 9, 5:03 am, JamesF <usaexportexpe...@gmail.com> wrote:
> why not just add some check while loading your models to see if they
> exist
>
> if(ClassRegistry::init($modelName)){
>
> }
>
> as an example (im sure there are better methods, check the api)
>
> On Aug 8, 3:09 pm, Abhimanyu Grover <gigapromot...@gmail.com> wrote:
>
> > Right now, If a table for a specific model is not found, CakePHP
> > execution stops with big "Missing database table" error - however
> > sometimes you may run into scenario where you need not following code
> > to run.. We ran into a similar scenario in a project which has like 30
> > models, out of which some are not always required on different client
> > setups. The problem occurred when we made a shell script which
> > performs some stuff on every model of system. So, whenever it tries to
> > load a model, say:
>
> > foreach($models as $modelName) {
> > $model = ClassRegistry::init($modelName);
>
> > }
>
> > So when a model whose db table doesn't exists, is being loaded - it
> > exits saying "Missing database table...." and doesnt go beyond. I went
> > a step ahead a tried overwriting Object::_stop() but that'll just
> > produce more warnings, and it just didnt worked.
>
> > Anyone faced this issue before? or Any ideas on getting ahead of the
> > problem?
>
> > Thanks guys.
> > Abhimanyu
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to