<commit_before><?php

/**
 * PluginsfSympalContentList form.
 *
 * @package    form
 * @subpackage sfSympalContentList
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
abstract class PluginsfSympalContentListForm extends BasesfSympalContentListForm
{
  public function setup()
  {
    parent::setup();

    $choices = array('' => '');

    $table = Doctrine_Core::getTable('sfSympalContent');
    foreach ($table->getColumns() as $name => $column)
    {
      $choices['Content']['c.'.$name] = $name;
    }

    $type = $this->object->ContentType->name;
    $type = $type ? $type : 'sfSympalPage';
    $groupName = str_replace('sfSympal', null, $type);

    $table = Doctrine_Core::getTable($type);
    foreach ($table->getColumns() as $name => $column)
    {
      $choices[$groupName]['cr.'.$name] = $name;
    }

    $this->widgetSchema['sort_column'] = new sfWidgetFormChoice(array('choices' => $choices));
    $this->widgetSchema['sort_order'] = new sfWidgetFormChoice(array('choices' => array('' => '', 'ASC' => 'ASC', 'DESC' => 'DESC')));

    $tableMethods = $this->_getTableMethods(array($type.'Table', 'Plugin'.$type.'Table'));

    $this->widgetSchema['table_method'] = new sfWidgetFormChoice(array('choices' => $tableMethods));
  }

  private function _getTableMethods($classes)
  {
    if (is_array($classes))
    {
      $tableMethods = array();
      foreach ($classes as $class)
      {
        $tableMethods = array_merge($tableMethods, $this->_getTableMethods($class));
      }
      return $tableMethods;
    } else {
      $class = $classes;
      $array1 = get_class_methods($class);
      if ($parentClass = get_parent_class($class)){
        $array2 = get_class_methods($parentClass);
        $array3 = array_diff($array1, $array2);
      } else {
        $array3 = $array1;
      }
      return $array3;
    }
  }
}<commit_msg>[1.4][sfSympalPlugin] Enhancing table_method option name and added empty value<commit_after><?php

/**
 * PluginsfSympalContentList form.
 *
 * @package    form
 * @subpackage sfSympalContentList
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
abstract class PluginsfSympalContentListForm extends BasesfSympalContentListForm
{
  public function setup()
  {
    parent::setup();

    $choices = array('' => '');

    $table = Doctrine_Core::getTable('sfSympalContent');
    foreach ($table->getColumns() as $name => $column)
    {
      $choices['Content']['c.'.$name] = $name;
    }

    $type = $this->object->ContentType->name;
    $type = $type ? $type : 'sfSympalPage';
    $groupName = str_replace('sfSympal', null, $type);

    $table = Doctrine_Core::getTable($type);
    foreach ($table->getColumns() as $name => $column)
    {
      $choices[$groupName]['cr.'.$name] = $name;
    }

    $this->widgetSchema['sort_column'] = new sfWidgetFormChoice(array('choices' => $choices));
    $this->widgetSchema['sort_order'] = new sfWidgetFormChoice(array('choices' => array('' => '', 'ASC' => 'ASC', 'DESC' => 'DESC')));

    $tableMethods = $this->_getTableMethods(array($type.'Table', 'Plugin'.$type.'Table'));
    $tableMethods = array_merge(array('' => ''), $tableMethods);

    $this->widgetSchema['table_method'] = new sfWidgetFormChoice(array('choices' => $tableMethods));
  }

  private function _getTableMethods($classes)
  {
    if (is_array($classes))
    {
      $tableMethods = array();
      foreach ($classes as $class)
      {
        $tableMethods = array_merge($tableMethods, $this->_getTableMethods($class));
      }
      return $tableMethods;
    } else {
      $class = $classes;
      $array1 = get_class_methods($class);
      if ($parentClass = get_parent_class($class)){
        $array2 = get_class_methods($parentClass);
        $array3 = array_diff($array1, $array2);
      } else {
        $array3 = $array1;
      }
      foreach ($array3 as $key => $value)
      {
        $array3[$key] = sfInflector::humanize(sfInflector::tableize($value)).': '.$class.'::'.$value.'()';
      }
      return $array3;
    }
  }
}
{'fraction_non_alphanumeric': 0.176427346238667, 'fraction_numerical': 0.0137221269296741, 'mean_word_length': 3.5608938547486035, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1224830', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1314, 'n_words': 233}