Yes, I thought so either, I checked it, but its OK there. Not to
mention that theese files were created by the bake.

On Apr 2, 3:15 pm, grigri <j...@hendersonwebdesign.com> wrote:
> Best guess, your model files are misnamed. Make sure they are in the
> correct directory and named `invoice.php` and `invoice_product.php`.
>
> hth
> grigri
>
> On Apr 2, 12:53 pm, logout <stefano...@gmail.com> wrote:
>
>
>
> > Sorry, I used the tab on my keyboard and send it twice even before
> > discribing the problem to the end.
>
> > So, if I call this:
>
> > $things = $this->Invoice->InvoiceProduct->myFind();
>
> > I get the error.
>
> > But if I call this:
>
> > $things = $this->Invoice->InvoiceProduct->find('all');
>
> > It works perfectly.
>
> > What's wrong here... I can't call a user defined function through the
> > model associations. But I have other models with other user defined
> > functions and there everything is OK.
>
> > On Apr 2, 2:46 pm, logout <stefano...@gmail.com> wrote:
>
> > > Guys, this is driving me mad...
>
> > > I have two models that are connected with the $hasMany and $belongsTo
> > > variables:
>
> > > class Invoice extends AppModel {
> > >         var $name = 'Invoice';
> > >         var $hasMany = array('InvoiceProduct');
>
> > > }
>
> > > and
>
> > > class InvoiceProduct extends AppModel {
> > >         var $name = 'InvoiceProduct';
> > >         var $belongsTo = array('Invoice');
>
> > > function myFind() {
> > >    return $this->find('all');
>
> > > }
> > > }
>
> > > OK. Now in the InvoicesController I have this call:
>
> > > $things = $this->Invoice->InvoiceProduct->myFind();
>
> > > Of cource, the myFind() is implemented in the InvoiceProduct model,
> > > for a simple examle:
>
> > > function myFind() {
> > >    return $this->find('all');
>
> > > }
>
> > > And it doesn't work. I get this message:
>
> > > Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> > > check the manual that corresponds to your MySQL server version for the
> > > right syntax to use near 'myFind' at line 1
>
> > > When I click on the Warning and then on the context I get this:
>
> > > $sql    =       "myFind"
> > > $error  =       "1064: You have an error in your SQL syntax; check the 
> > > manual
> > > that corresponds to your MySQL server version for the right syntax to
> > > use near 'myFind' at line 1"
> > > $out    =       null- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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