Friday, January 27, 2012

Are child contain rules duplicated across parents? Unexpected results.

This is a Cake 2 project. Also posted issue here: http://bin.cakephp.org/view/285982918

Post belongsTo User
User hasMany AvatarSet (alias of Asset with model=>User,
name=avatar, polymorphic)

Comment belongsTo User
User hasMany AvatarSet (alias of Asset with model=>User,
name=avatar, polymorphic)

Polymorphic Event belongsTo Post (Subject Model) and Comment
(Event Model) (belongsTo are bound on the fly but not sure if that's
effecting the contain problem)

Problem: containable applies settings to both Post and Comment
when doing this:

Event->contain(array(
'Post' => array(
'User'
),
'Comment' => array(
'User' => array(
'AvatarSet'
)
));

Results were unexpected. Both 'Post.User' and 'Comment.User' have
'AvatarSet'. Also tried it with my 'Avatar' alias which is a hasOne.
Results same.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: