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
---------------------------
<?php
class Model extends AppModel
{
var $name = 'Model';
var $validate = array(
'codice' => '/^.{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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---