Spoke too soon. It works a charm for logging in but I'm seeing other
problems elsewhere. It seems that Containable & Polymorphic aren't
playing well together.

Basically, I have a User model and several other models which are
types of users, eg. Professional, Organisation, etc.

So, I have another model, Resource, of which a Professional can have
many. I'm trying to paginate resources along with info on the owner
professional:

class Professional extends AppModel
{
        var $name = 'Professional';
        
    var $hasOne = array(
        'User' => array(
            'className' => 'User',
            'foreignKey' => 'foreign_key',
            'conditions' => array('User.model' => 'Professional'),
            'dependent' => true
        )
    );
        var $hasMany = array(
                'Resource'
        );
}

class Resource extends AppModel
{
        var $name = 'Resource';
        var $belongsTo = array('User', 'MediaType');
}


ResourcesController:

var $paginate = array(
        'limit' => 20,
        'page' => 1,
        'order'=>array('Resource.created' => 'desc'),
        'fields' => array(
                'Resource.id',
                'Resource.title',
                'Resource.slug',
                'Resource.thumbnail',
                'Resource.user_id'
        ),
        'contain' => array(
                'MediaType' => array(
                        'fields' => array('name_en')
                ),
                'User' => array(
                        'fields' => array(
                                'id',
                                'model',
                                'foreign_key'
                        ),
                        'Professional' => array(
                                'fields' => array(
                                        'user_id',
                                        'first_name',
                                        'last_name',
                                        'slug'
                                )
                        )
                )
        )
);
        
Warning (512): Model "User" is not associated with model
"Professional" [CORE/cake/libs/model/behaviors/containable.php, line
340]

Arrrgghhh!! It's beginning to look like I'm screwed. I don't want to
go back to having all user info in a single model with a separate
usertypes table because it's caused a hundred and one headaches.

But  I've no idea how to get this working with Cake. I don't even know
anymore if this particular design pattern makes any sense. But, I
can't be the only person doing this.

Any ideas?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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