<commit_before><?php

/**
 * Plugin configuration
 *
 * @package    ioDoctrineMenuPlugin
 * @subpackage actions
 * @author     <NAME> <<EMAIL>>
 */
class Baseio_doctrine_menuActions extends sfActions
{
  /**
   * The main action that handles menu reordering
   */
  public function executeReorder(sfWebRequest $request)
  {
    $this->menu = $this->getRoute()->getObject();
  }

  /**
   * Responds to an ajax call by nested sortable and delivers a json
   * object of the given tree
   */
  public function executeJson(sfWebRequest $request)
  {
    $name = $request->getParameter('name');
    $menu = Doctrine::getTable('ioDoctrineMenuItem')->findAllNestedsetJson($name);

    return $this->renderText(json_encode($menu));
  }

  /**
   * Receives the ajax post to save the menu ordering
   */
  public function executeSavejson(sfWebRequest $request)
  {
    $name = $request->getParameter('name');

    if ($nestedSet = $request->getParameter('nested-sortable-widget'))
    {
      // Start with the root
      Doctrine::getTable("ioDoctrineMenuItem")->restoreTreeFromNestedArray($nestedSet['items'], $name);

      return true;
    }

    return false;
  }
}<commit_msg>Reworking a few actions to use the object routes.<commit_after><?php

/**
 * Plugin configuration
 *
 * @package    ioDoctrineMenuPlugin
 * @subpackage actions
 * @author     <NAME> <<EMAIL>>
 */
class Baseio_doctrine_menuActions extends sfActions
{
  /**
   * The main action that handles menu reordering
   */
  public function executeReorder(sfWebRequest $request)
  {
    $this->menu = $this->getRoute()->getObject();
  }

  /**
   * Responds to an ajax call by nested sortable and delivers a json
   * object of the given tree
   */
  public function executeJson(sfWebRequest $request)
  {
    $menu = $this->getRoute()->getObject();
    $arr = $menu->generateNestedSortableArray();

    return $this->renderText(json_encode($arr));
  }

  /**
   * Receives the ajax post to save the menu ordering
   */
  public function executeSaveJson(sfWebRequest $request)
  {
    $menu = $this->getRoute()->getObject();

    if ($nestedSet = $request->getParameter('nested-sortable-widget'))
    {
      // Start with the root
      Doctrine::getTable("ioDoctrineMenuItem")->restoreTreeFromNestedArray($nestedSet['items'], $menu);

      return true;
    }

    return false;
  }
}
{'fraction_non_alphanumeric': 0.1306939123031077, 'fraction_numerical': 0.0, 'mean_word_length': 3.519230769230769, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, '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': '5044373', 'n_tokens_mistral': 720, 'n_tokens_neox': 695, 'n_words': 172}