Re: Problem with belongsTo

2007-11-01 Thread plinto

Thanks, everything works now

On Oct 29, 11:24 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> Don't have a class called Model - this will conflict with the core
> Model.
>
> Otherwise it looks ok.  Are you sure there are associated records to
> retrieve?  Put your DEBUG to 2 in /app/config/core.php to see what SQL
> is being generated, the query should join across the other two tables.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Problem with belongsTo

2007-10-29 Thread Grant Cox

Don't have a class called Model - this will conflict with the core
Model.

Otherwise it looks ok.  Are you sure there are associated records to
retrieve?  Put your DEBUG to 2 in /app/config/core.php to see what SQL
is being generated, the query should join across the other two tables.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Problem with belongsTo

2007-10-29 Thread plinto

Hi, I am having a problem with, i think, $belongsTo, it seems set up
right (I do the exact same thing for another model and it works
perfectly) but I am not getting the results of the two tables that are
associated.
If anyone can help, thanks!
Here is the code I use:

Tables
---
models: id, modello, prezzo, codice, version_id, brand_id
versions: id, description
brands: id, description

model.php
---
 '/^.{2,20}$/',
'modello' => '/^.{2,20}$/',
'prezzo' => '/^.{2,20}$/',
);
var $belongsTo = array('Version' => array('className' => 'Version'),
'Brand' => 
array('className' => 'Brand')
);
}
?>

models_controller.php
---

function index()
{
$this->set('aa', $this->Model->findAll());
.

index.thtml
---

var_dump($aa);
.

Result

array(1) { [0]=>  array(1) { ["Model"]=>  array(6) { ["id"]=>
string(1) "1" ["codice"]=>  string(0) "" ["modello"]=>  string(0)
"" ["version_id"]=>  string(1) "0" ["prezzo"]=>  string(1)
"0" ["brand_id"]=>  string(1) "0" } } }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Problem with belongsTo

2007-10-29 Thread plinto

Hi, I am having a problem with, i think, $belongsTo, it seems set up
right (I do the exact same thing for another model and it works
perfectly) but I am not getting the results of the two tables that are
associated.
If anyone can help, thanks!
Here is the code I use:

Tables
---
models: id, modello, prezzo, codice, version_id, brand_id
versions: id, description
brands: id, description

model.php
---
 '/^.{2,20}$/',
'modello' => '/^.{2,20}$/',
'prezzo' => '/^.{2,20}$/',
);
var $belongsTo = array('Version' => array('className' => 'Version'),
'Brand' => 
array('className' => 'Brand')
);
}
?>

models_controller.php
---

function index()
{
$this->set('aa', $this->Model->findAll());
.

index.thtml
---

var_dump($aa);
.

Result

array(1) { [0]=>  array(1) { ["Model"]=>  array(6) { ["id"]=>
string(1) "1" ["codice"]=>  string(0) "" ["modello"]=>  string(0)
"" ["version_id"]=>  string(1) "0" ["prezzo"]=>  string(1)
"0" ["brand_id"]=>  string(1) "0" } } }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---