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