Also, if you are just trying to see if all the data is being pulled in
from your Network and User classes,

Try using
echo '<pre>';
print_r($this->Network);
echo '</pre>';

in your controller method from which you are trying to view the data.
Again this is strictly for viewing the data your class is getting.


On Feb 14, 5:20 pm, "mindcharger" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Here's another 'hasMany/belongTo' question... :-)
>
> I have read the user manual but either I didn't understood it or I am
> goin' nuts... :-P
>
> I have this DB structure:
>
> Table 'users':
> +------------+------------------+------+-----+---------
> +----------------+
> | Field      | Type             | Null | Key | Default |
> Extra          |
> +------------+------------------+------+-----+---------
> +----------------+
> | user_id    | int(10) unsigned | NO   | PRI | NULL    |
> auto_increment |
> | login      | varchar(25)      | NO   |     |
> |                |
> | password   | varchar(25)      | NO   |     |
> |                |
> | network_id | int(10) unsigned | NO   | MUL |
> |                |
> +------------+------------------+------+-----+---------
> +----------------+
>
> Table 'network':
> +-------------+------------------+------+-----+---------
> +----------------+
> | Field       | Type             | Null | Key | Default |
> Extra          |
> +-------------+------------------+------+-----+---------
> +----------------+
> | network_id  | int(10) unsigned | NO   | PRI | NULL    |
> auto_increment |
> | name        | varchar(50)      | YES  |     | NULL
> |                |
> | description | varchar(100)     | YES  |     | NULL
> |                |
> | location    | varchar(25)      | YES  |     | NULL
> |                |
> +-------------+------------------+------+-----+---------
> +----------------+
>
> And this model code (using scaffolding for now, so no wicked
> controller logic...):
>
> class User extends AppModel
> {
>
>  var $name = 'User';
>  var $useTable = 'users';
>  var $primaryKey = 'user_id';
>
>  var $belongsTo = array('Network' =>
>                            array('className'  => 'Network',
>                                  'conditions' => '',
>                                  'order'      => '',
>                                  'foreignKey' => 'network_id'
>                            )
>                      );
>
> }
>
> class Network extends AppModel
> {
>  var $name = 'Network';
>  var $useTable = 'networks';
>  var $primaryKey = 'network_id';
>
>  var $hasMany = array('User' =>
>                          array('className'     => 'User',
>                                'conditions'    => '',
>                                'order'         => '',
>                                'limit'         => '',
>                                'foreignKey'    => 'network_id',
>                                'dependent'     => true,
>                                'exclusive'     => false,
>                                'finderQuery'   => ''
>                          )
>                   );
>
> }
>
> When I access the "network view" feature (http://localhost:8080/
> networks/view/0/) I don't see any "Related Users".
> I just get the "new user" option.
>
> My question is: if I have the DB tables populated (there is a user
> which belongs to network 0), shouldn't I get
> to see that user listed on the screen when I view network 0?
>
> Am I doing something wrong?
>
> Thanks a lot!


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

Reply via email to