model.php line 1388 in function updateCounterCache says foreach ($this->belongsTo as $parent => $assoc) {
therefore in theory you could use this belongsTo method.
Somebody, please confirm this.
Faifas
On Sun, Aug 30, 2009 at 11:14, WebbedIT <paul@webbedit.co.uk> wrote:
I *think* the OP is actually after two counterCaches for just one
relation ... one having a condition that only counts the users private
records and another which includes all records.
If this is the case I am not sure if it is possible without modifying
counterCache's behaviour as I don't think you can tell it to update a
field other than model_count, so you couldn't specify say a
model_private_count with an alternative counterScope.
Would be nice if he could do something along the lines of:
Comment Model:
User hasMany Post
User hasMany Comment
var $belongsTo = array(
'Post' => array(
'counterCache' => true
),
'PostPrivate' => array(
'className' => 'Post',
'counterCache' => true,
'counterField' => 'comment_private_count',
'counterScope' => array('private' => 1)
)
);
--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment