@John

* When the table is named invoice_statuses, the error message reads,
"Error:  Database table invoicestatuses for model Invoicestatus was
not found."

* When the table is named invoicestatuses, the error message reads,
"Error:  Database table invoice_statuses for model InvoiceStatus was
not found."

So as you can see, it's a catch-22 as when I name the table one way,
it looks for the other and vice versa.

Note that I'm using ACL and hadn't added any ACOs as I didn't have
methods yet in my controller.  I also didn't have any beforefilter in
my controller to allow any actions, bypassing Auth.  The issue was
fixed when I added the following:

function beforeFilter() {
    parent::beforeFilter();
        $this->Auth->allowedActions = array('*');
}

This worked fine with the table named as "invoicestatuses", which was
its initial name.  While I'm glad I can now use scaffolding, I'm
unclear as to why this error message appears and is related to the
above Auth fix.  The model itself is simple, and since you asked here
is that code:

class InvoiceStatus extends AppModel {
        var $name = 'InvoiceStatus';
        var $hasMany = array(
                'Invoice'
        );
        var $validate = array(
                'name' => array('notempty')
        );
}

@Dave - This is not a HABTM scenario, rather a simple lookup table
with name and ID key pairs.

On Nov 27, 5:04 pm, Dave <davidcr...@gmail.com> wrote:
> It sounds like you are trying to create a HABTM join table, if so, I
> recommend reading the manual on how to do this through CakePHP.  There
> should be no need to actually create a model for this table, and cake will
> handle all of the relationships for you =)
>
> http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
>
> <http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM>
>
> On Fri, Nov 27, 2009 at 6:40 AM, John Andersen <j.andersen...@gmail.com>wrote:
>
> > Which table does CakePHP say it can't find? Is it "invoices_statuses"
> > or "invoice_statusses"?
> > Show the error and maybe also the model definition!
> > Enjoy,
> >    John
>
> > On Nov 25, 3:12 pm, Kerr <hayl...@gmail.com> wrote:
> > > Hi folks, I'm using CakePHP for a new project, and I am having a great
> > > time not having to do so much CRUD work!  That said, I want to set up
> > > a simple $scaffold based model, and I'm having trouble reconciling a
> > > table to a model.  My application handles client billing for a
> > > business, and I have a model named Invoice, with all the convention
> > > based names for tables, columns, controllers, etc.  Invoices must
> > > carry a status, and here is where I'm having some trouble.  Here is
> > > the layout of the assets in question:
>
> > > Table name: invoicestatuses (OR invoice_statuses)
> > > Model name: InvoiceStatus
> > > Model file name: invoice_status.php
> > > Controller name: InvoiceStatusesController
> > > Controller file name: invoicestatuses_controller.php
>
> > > CakePHP is able to find my model and controller, but it chokes on
> > > locating the table.  If I use the former table name, CakePHP throws an
> > > error saying it can't find the latter, and vice versa.  I've tried
> > > hardcoding either table in my model using the $table variable, and
> > > even $useTable (not sure if that would generally work anyway), but
> > > CakePHP always comes back telling me it can't find the table for my
> > > model.
>
> > > What am I doing wrong here?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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 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