src/Cache/DatabaseTreeCache.php
public function registerDcaToCacheTree(string $table, array $columns = [], array $values = [], array $options = [], string $key = 'id')
    {
        System::getContainer()->get('huh.utils.dca')->loadDc($table);

        if (!isset($GLOBALS['TL_DCA'][$table])) {
            return false;
        }

        $GLOBALS['TL_DCA'][$table]['config']['treeCache'][$key] = [
            'columns' => $columns,
            'values' => $values,
            'options' => $options,
            'key' => $key,
        ];

        $GLOBALS['TL_DCA'][$table]['config']['ondelete_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];
        $GLOBALS['TL_DCA'][$table]['config']['oncut_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];
        $GLOBALS['TL_DCA'][$table]['config']['onsubmit_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];
        $GLOBALS['TL_DCA'][$table]['config']['onrestore_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];

        return true;
    }
public function registerDcaToCacheTree(string $table, array $columns = [], array $values = [], array $options = [], string $key = 'id')
    {
        System::getContainer()->get('huh.utils.dca')->loadDc($table);

        if (!isset($GLOBALS['TL_DCA'][$table])) {
            return false;
        }

        $GLOBALS['TL_DCA'][$table]['config']['treeCache'][$key] = [
            'columns' => $columns,
            'values' => $values,
            'options' => $options,
            'key' => $key,
        ];

        $GLOBALS['TL_DCA'][$table]['config']['ondelete_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];
        $GLOBALS['TL_DCA'][$table]['config']['oncut_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];
        $GLOBALS['TL_DCA'][$table]['config']['onsubmit_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];
        $GLOBALS['TL_DCA'][$table]['config']['onrestore_callback']['huh.utils.cache.database_tree'] = ['huh.utils.cache.database_tree', 'purgeCacheTree'];

        return true;
    }
public function registerDcaToCacheTree ( string $ table , array $ columns = [ ] , array $ values = [ ] , array $ options = [ ] , string $ key = 'id' ) { System :: getContainer ( ) -> get ( 'huh.utils.dca' ) -> loadDc ( $ table ) ; if ( ! isset ( $ GLOBALS [ 'TL_DCA' ] [ $ table ] ) ) { return false ; } $ GLOBALS [ 'TL_DCA' ] [ $ table ] [ 'config' ] [ 'treeCache' ] [ $ key ] = [ 'columns' => $ columns , 'values' => $ values , 'options' => $ options , 'key' => $ key , ] ; $ GLOBALS [ 'TL_DCA' ] [ $ table ] [ 'config' ] [ 'ondelete_callback' ] [ 'huh.utils.cache.database_tree' ] = [ 'huh.utils.cache.database_tree' , 'purgeCacheTree' ] ; $ GLOBALS [ 'TL_DCA' ] [ $ table ] [ 'config' ] [ 'oncut_callback' ] [ 'huh.utils.cache.database_tree' ] = [ 'huh.utils.cache.database_tree' , 'purgeCacheTree' ] ; $ GLOBALS [ 'TL_DCA' ] [ $ table ] [ 'config' ] [ 'onsubmit_callback' ] [ 'huh.utils.cache.database_tree' ] = [ 'huh.utils.cache.database_tree' , 'purgeCacheTree' ] ; $ GLOBALS [ 'TL_DCA' ] [ $ table ] [ 'config' ] [ 'onrestore_callback' ] [ 'huh.utils.cache.database_tree' ] = [ 'huh.utils.cache.database_tree' , 'purgeCacheTree' ] ; return true ; }
Register a dca to the tree cache.

@param string $table   (The dca table)
@param array  $columns Parent sql filter columns (e.g. `tl_page.type`)
@param array  $values  Parent sql filter values (e.g. `root` for `tl_page.type`)
@param array  $options SQL Options for sorting
@param string Custom index key (default: primary key from model)

@return bool Acknowledge state if register succeeded
Register a dca to the tree cache .