<commit_before><?php
/**
 * @version      $Id$
 * @category	 Nooku
 * @package      Nooku_Server
 * @subpackage   Categories
 * @copyright    Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license      GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link         http://www.nooku.org
 */

/**
 * Cascadable Database Behavior Class
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/johnbell>
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories    
 */
class ComCategoriesDatabaseBehaviorCascadable extends KDatabaseBehaviorAbstract
{
    /**
     * Deletes dependent rows.
     *
     * This performs an intelligent delete 
     *
     * @return KDatabaseRowAbstract
     */
    protected function _beforeTableDelete(KCommandContext $context)
    {
        $result = true;
        
        $section = $this->section;
        if ( is_numeric($section) || !$section) {
            $section = 'com_articles';
        } 
        
        $parts = explode('_',$section);
            
        //@TODO : Remove when refactoring is completed
        switch ($parts[1])
        {
            case 'contact':
                $name = 'contacts';
                $package ='contact';
                break;
            default :
                $name = KInflector::pluralize($parts[1]);
                $package = $name;
        }
                 
        $identifier = 'com://admin/'.$package.'.model.'.$name;
        
        $rowset = $this->getService($identifier)
                    ->category($this->id)
                    ->limit(0)
                    ->getList();

        if($rowset->count()) {
            $result = $rowset->delete();
        } 
        
        return $result; 
    }
}<commit_msg>KModelTable limit state doesn't have a default. No longer need to force the limit to 0. <commit_after><?php
/**
 * @version      $Id$
 * @category	 Nooku
 * @package      Nooku_Server
 * @subpackage   Categories
 * @copyright    Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license      GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link         http://www.nooku.org
 */

/**
 * Cascadable Database Behavior Class
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/johnbell>
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories    
 */
class ComCategoriesDatabaseBehaviorCascadable extends KDatabaseBehaviorAbstract
{
    /**
     * Deletes dependent rows.
     *
     * This performs an intelligent delete 
     *
     * @return KDatabaseRowAbstract
     */
    protected function _beforeTableDelete(KCommandContext $context)
    {
        $result = true;
        
        $section = $this->section;
        if ( is_numeric($section) || !$section) {
            $section = 'com_articles';
        } 
        
        $parts = explode('_',$section);
            
        //@TODO : Remove when refactoring is completed
        switch ($parts[1])
        {
            case 'contact':
                $name = 'contacts';
                $package ='contact';
                break;
            default :
                $name = KInflector::pluralize($parts[1]);
                $package = $name;
        }
                 
        $identifier = 'com://admin/'.$package.'.model.'.$name;
        
        $rowset = $this->getService($identifier)
                    ->category($this->id)
                    ->getList();

        if($rowset->count()) {
            $result = $rowset->delete();
        } 
        
        return $result; 
    }
}
{'fraction_non_alphanumeric': 0.12918526785714285, 'fraction_numerical': 0.004464285714285714, 'mean_word_length': 1.681376215407629, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3838464', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1012, 'n_words': 211}