Ah! Thanks for the reply, Walther. Guess you solved it for both of us!

On Mar 4, 1:43 am, Walther <[email protected]> wrote:
> Don't use 'require' ever!
>
> Make use of the tools that CakePHP gives you. In this case
> App::import('Model', 'Order');
>
> As for your problem, it has a very easy solution. Your filename is
> wrong.
>
> CakePHP uses CamelCase model/class names, and underscored file names.
> So when you say 'I want to use model CompleteOrder' CakePHP looks for
> the file complete_order.php, which doesn't exist (Since your file is
> called completeorder.php). If CakePHP can't find the model file it
> creates a default model based on your AppModel. And, the default model
> is looking for the complete_orders table since it doesn't know about
> your $useTable (Which is in the wrong file).
>
> Simple solution, rename your model file to complete_order.php
>
> On Mar 3, 12:08 pm, "[email protected]" <[email protected]> wrote:
>
> > Hi
>
> > I'm playing with creating alternate models as a way to avoid custom
> > queries and have completeorder.php that currently looks like this
>
> > require_once(APP_PATH.DS.'models'.DS.'order.php');
> > class CompleteOrder extends Order {
> >         var $name = 'CompleteOrder';
> >         var $useTable = 'orders';
>
> > }
>
> > The base class Order has all the smarts and the parent model has a
> > complex hasMany condition to filter out the uncompleted orders.
>
> > Problem
> > ======
>
> > When I call the page for the parent I get
>
> > Error:  Database table complete_orders for model CompleteOrder  was
> > not found.
>
> > I've gone through the cache and cleared it out etc.
>
> > What could be stopping this model from referencing the right table?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to