It doesn't seem to want to let me post comments in the bakery,
so..posting this here instead.
---
QUESTIONS:

Anyway, two questions. One, is this supposed to work in scaffolding? I
have "Users", which are broken into "Employers" and "Workers". When I
view a user, it doesn't pull up any of the related Employer or Worker
data...I think I followed this tutorial exactly.

Second part, I assume the behavior is supposed to go in app/models? Do
I need to import it or anything? I can't even tell if its being
included or not, since it doesn't give an error if the model doesn't
exist..?


RAMBLINGS:

I find this ("Notes") to be sort of a cryptic example. A better
example might be "People" which could be divided into "Students" and
"Teachers" for example.

Secondly, in this case, I find that Student belongsTo Person makes
slightly more sense than hasOne or hasMany, not that this is terribly
important..

CODE:

// user.php
class User extends AppModel {

        var $name = 'User';

        var $actsAs = array('Polymorphic');

        var $displayField = 'username';

        //The Associations below have been created with all possible keys,
those that are not needed can be removed
        var $belongsTo = array(
                        'Group' => array('className' => 'Group',
                                                                'foreignKey' => 
'group_id',
                                                                'conditions' => 
'',
                                                                'fields' => '',
                                                                'order' => ''
                        )
        );
// *snip*


// worker.php
class Worker extends AppModel {

        var $name = 'Worker';

        var $displayField = 'last_name';

        //The Associations below have been created with all possible keys,
those that are not needed can be removed
        var $hasMany = array(
                'User' => array(
                        'className' => 'User',
                        'foreignKey' => 'foreign_id',
                        'conditions' => array('User.class' => 'Worker'),
                        'dependent' => true
                )
        );
// *snip*

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to