Countercache for children

I am looking at the countercache, and was wondering if there is easy way to use it with parents and children?

https://book.cakephp.org/3.0/en/orm/behaviors/counter-cache.html#advanced-usage

The CounterCache behavior works for belongsTo associations only.

you can probably (because i havent tried) set it with parents as Children belongsTo Parent

`$this->addBehavior(‘CounterCache’, [
‘ParentCategories’ => [
‘article_count’ => function ($event, $entity, $table, $original) {

                $categories = $this->find('all')->where(['parent_id' => $entity->parent_id]);
                $collection = new Collection($categories);
                
                return $collection->sumOf('article_count');
            },
        ]
    ]);`

I have this. But is not working.

Actually what I want is when the article gets added/updated that the counts run. But this does not happen?

Also when you update one category it will update the direct parent. But it will not recursively update the parent of the parent.

I guess the countercache does not trigger countercache on deeper relations. It only works on a 1 to 1 basis?

Anyone have any idea how to do it?