Non Working Relationship

Posted by Dominik K. on Stack Overflow See other posts from Stack Overflow or by Dominik K.
Published on 2010-04-12T17:42:08Z Indexed on 2010/04/12 17:42 UTC
Read the original article Hit count: 415

Filed under:
|
|
|

Hello everyone,

I got a problem with cake's model architecture.

I got a Users-Model and a Metas-Model. Here are the model codes:

Users:

<?php
class User extends AppModel {

var $name = 'User';
var $validate = array(
    'username' => array('notempty'),
    'email' => array('email'),
    'password' => array('notempty')
);
    var $displayField = 'username';


var $hasMany = array(
        'Meta' => array(
            'className' => 'Meta',
            'foreignKey' => 'user_id'        
        )
);

}
?>

and the Metas Model:

<?php
class Meta extends AppModel {

var $name = 'Meta';

//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
    'User' => array(
        'className' => 'User',
        'foreignKey' => 'user_id',
        'required' => true
    )
);

}
?>

So now the question is why do I not get the Meta data into the User array? Should I get it in the Auth object?

Or where can I work with the meta data?

hope you can help me!

Have a nice Day! Dom

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about php