Hi,

I'm using Cake 1.3.13.

I have an strange issue with counterCache, that I've never seen
before.

So, I have Personality belongsTo User and Personality belongsTo
Category associations:

        public $belongsTo = array(
                'Category' => array(
                        'className' => 'Category',
                        'foreignKey' => 'category_id',
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'counterCache' => true,
                        'counterScope' => array('Personality.valid' => 1)
                ),
                'User' => array(
                        'className' => 'User',
                        'foreignKey' => 'user_id',
                        'conditions' => '',
                        'fields' => '',
                        'order' => '',
                        'counterCache' => true,
                        'counterScope' => array('Personality.valid' => 1)
                )
        );

In my personalities and categories tables, I have a
"personality_count" field (TINYINT).
When I add a Personality and I set "valid" to 1, all is right, the
counters are updated.

In my personality edit view, I have a checkbox to validate or
invalidate the record (Personality.valid = 0 or 1).
If I invalidate a personality, all is right, the counters are updated
(- 1).
But after that, if I validate the personality again, the counters
don't change?!

What's the mistake? Thank's fo any idea.

By the way, why there is a "$created" param in
Model::updateCounterCache() while it is never used inside the method??

Avairet

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to