Re: What's wrong here?

2009-04-02 Thread Marcelo Andrade

On Thu, Apr 2, 2009 at 8:46 AM, logout  wrote:
>
> class InvoiceProduct extends AppModel {
>        var $name = 'InvoiceProduct';
>        var $belongsTo = array('Invoice');
>
> function myFind() {
>   return $this->find('all');
> }
> }
>
> (..)
> $things = $this->Invoice->InvoiceProduct->myFind();
>
> (..)
> 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

I'm not sure about the effectiveness of this, buy try add
the InvoiceProduct in the "uses" attribute on your controller,
and then try the query as:

$things = $this->InvoiceProduct->myFind();

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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



Re: What's wrong here?

2009-04-02 Thread logout

Well, guys, I have two similar projects and I used the wrong file...
The file name was correct, but not the path... sorry for the alarm,
but I lost two hours... I guess I need some rest :)

On Apr 2, 3:19 pm, Jon Bennett  wrote:
> > Best guess, your model files are misnamed. Make sure they are in the
> > correct directory and named `invoice.php` and `invoice_product.php`.
>
> hmm, I don't think that's it, as the model is being called. I think
> the 'myFind' method is not defined, or is called something else,
> because cake tries to run a query when it can't find a model method.
>
> hth
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: What's wrong here?

2009-04-02 Thread Jon Bennett

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

paste your models in here: http://bin.cakephp.org/add/logout

j

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



Re: What's wrong here?

2009-04-02 Thread logout

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



Re: What's wrong here?

2009-04-02 Thread Jon Bennett

> Best guess, your model files are misnamed. Make sure they are in the
> correct directory and named `invoice.php` and `invoice_product.php`.

hmm, I don't think that's it, as the model is being called. I think
the 'myFind' method is not defined, or is called something else,
because cake tries to run a query when it can't find a model method.

hth

jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



Re: What's wrong here?

2009-04-02 Thread grigri

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  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  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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What's wrong here?

2009-04-02 Thread logout

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  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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---