<commit_before><?php

/**
 * rtShopAttributeAdmin actions.
 *
 * @package    symfony
 * @subpackage rtShopAttributeAdmin
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class rtShopAttributeAdminActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
    $this->rt_shop_attributes = Doctrine::getTable('rtShopAttribute')
      ->createQuery('a')
      ->execute();
  }

  public function executeNew(sfWebRequest $request)
  {
    $this->form = new rtShopAttributeForm();
  }

  public function executeCreate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod(sfRequest::POST));

    $this->form = new rtShopAttributeForm();

    $this->processForm($request, $this->form);

    $this->setTemplate('new');
  }

  public function executeEdit(sfWebRequest $request)
  {
    $this->forward404Unless($rt_shop_attribute = Doctrine::getTable('rtShopAttribute')->find(array($request->getParameter('id'))), sprintf('Object rt_shop_attribute does not exist (%s).', $request->getParameter('id')));
    $this->form = new rtShopAttributeForm($rt_shop_attribute);
  }

  public function executeUpdate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
    $this->forward404Unless($rt_shop_attribute = Doctrine::getTable('rtShopAttribute')->find(array($request->getParameter('id'))), sprintf('Object rt_shop_attribute does not exist (%s).', $request->getParameter('id')));
    $this->form = new rtShopAttributeForm($rt_shop_attribute);

    $this->processForm($request, $this->form);

    $this->setTemplate('edit');
  }

  public function executeDelete(sfWebRequest $request)
  {
    $request->checkCSRFProtection();

    $this->forward404Unless($rt_shop_attribute = Doctrine::getTable('rtShopAttribute')->find(array($request->getParameter('id'))), sprintf('Object rt_shop_attribute does not exist (%s).', $request->getParameter('id')));
    $rt_shop_attribute->delete();

    $this->redirect('rtShopAttributeAdmin/index');
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $rt_shop_attribute = $form->save();

      $action = $request->getParameter('rt_post_save_action', 'index');

      if($action == 'edit')
      {
        $this->redirect('rtShopAttributeAdmin/edit?id='.$rt_shop_attribute->getId());
      }

      $this->redirect('rtShopAttributeAdmin/edit?id='.$rt_shop_attribute->getId());
    }
  }
}<commit_msg>Corrected post save redirect back to index.<commit_after><?php

/**
 * rtShopAttributeAdmin actions.
 *
 * @package    symfony
 * @subpackage rtShopAttributeAdmin
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class rtShopAttributeAdminActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
    $this->rt_shop_attributes = Doctrine::getTable('rtShopAttribute')
      ->createQuery('a')
      ->execute();
  }

  public function executeNew(sfWebRequest $request)
  {
    $this->form = new rtShopAttributeForm();
  }

  public function executeCreate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod(sfRequest::POST));

    $this->form = new rtShopAttributeForm();

    $this->processForm($request, $this->form);

    $this->setTemplate('new');
  }

  public function executeEdit(sfWebRequest $request)
  {
    $this->forward404Unless($rt_shop_attribute = Doctrine::getTable('rtShopAttribute')->find(array($request->getParameter('id'))), sprintf('Object rt_shop_attribute does not exist (%s).', $request->getParameter('id')));
    $this->form = new rtShopAttributeForm($rt_shop_attribute);
  }

  public function executeUpdate(sfWebRequest $request)
  {
    $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
    $this->forward404Unless($rt_shop_attribute = Doctrine::getTable('rtShopAttribute')->find(array($request->getParameter('id'))), sprintf('Object rt_shop_attribute does not exist (%s).', $request->getParameter('id')));
    $this->form = new rtShopAttributeForm($rt_shop_attribute);

    $this->processForm($request, $this->form);

    $this->setTemplate('edit');
  }

  public function executeDelete(sfWebRequest $request)
  {
    $request->checkCSRFProtection();

    $this->forward404Unless($rt_shop_attribute = Doctrine::getTable('rtShopAttribute')->find(array($request->getParameter('id'))), sprintf('Object rt_shop_attribute does not exist (%s).', $request->getParameter('id')));
    $rt_shop_attribute->delete();

    $this->redirect('rtShopAttributeAdmin/index');
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $rt_shop_attribute = $form->save();

      $action = $request->getParameter('rt_post_save_action', 'index');

      if($action == 'edit')
      {
        $this->redirect('rtShopAttributeAdmin/edit?id='.$rt_shop_attribute->getId());
      }

      $this->redirect('rtShopAttributeAdmin/index');
    }
  }
}
{'fraction_non_alphanumeric': 0.1660750980758453, 'fraction_numerical': 0.012703157108163646, 'mean_word_length': 5.070294784580499, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 92, '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': '4503509', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1592, 'n_words': 248}