<commit_before><?php

namespace Citrus\Cluster\Controller;

use Symfony\Component\HttpFoundation\Request as SfRequest,
	Citrus\Cluster\Response\ResponseCachedJson,
	Citrus\Cluster\Form,
	Symfony\Component\HttpFoundation\RedirectResponse;

class ObjectController extends Controller {

	protected $resource;
	protected $className;

	public function __construct() 
	{
		$this->className = preg_replace('/Controller$/', '', get_called_class());
	}

	public function doEdit( SfRequest $request )
	{
		$this->retrieveInstance($request);

		if (!$this->resource) 
			$this->resource = new $this->className();

		if ($request->getMethod() == 'POST') {
			if ($this->resource->hydrate( $request->request->all() ))
			{
				Message::addInfo($this->resource->getView()->getInformations('name'), 'Modification de ' . $this->resource );
				$this->resource->save();
			}
			
			if (!$request->isXmlHttpRequest())
				return new RedirectResponse("/classes/" . $this->getSlug( $this->className ) . "/" . $this->resource->id . "/edit");
		}

		$form = Form\Form::fromObject( $this->resource, 'edit' ) ;
		$form->setMethod( $request->isXmlHttpRequest() ? 'post' : 'inline');
		return array( 
			'resource' => $this->resource->toArray(),
			'object' => $this->resource->getView()->getInformations('name'),
			'form' => $form
		);
	}

	public function doDelete( SfRequest $request )<commit_msg>Message debug<commit_after><?php

namespace Citrus\Cluster\Controller;

use Symfony\Component\HttpFoundation\Request as SfRequest,
	Citrus\Cluster\Response\ResponseCachedJson,
	Citrus\Cluster\Form,
	Citrus\Cluster\Message,
	Symfony\Component\HttpFoundation\RedirectResponse;

class ObjectController extends Controller {

	protected $resource;
	protected $className;

	public function __construct() 
	{
		$this->className = preg_replace('/Controller$/', '', get_called_class());
	}

	public function doEdit( SfRequest $request )
	{
		$this->retrieveInstance($request);

		if (!$this->resource) 
			$this->resource = new $this->className();

		if ($request->getMethod() == 'POST') {
			if ($this->resource->hydrate( $request->request->all() ))
			{
				Message::addInfo($this->resource->getView()->getInformations('name'), 'Modification de ' . $this->resource );
				$this->resource->save();
			}

			if (!$request->isXmlHttpRequest())
				return new RedirectResponse("/classes/" . $this->getSlug( $this->className ) . "/" . $this->resource->id . "/edit");
		}

		$form = Form\Form::fromObject( $this->resource, 'edit' ) ;
		$form->setMethod( $request->isXmlHttpRequest() ? 'post' : 'inline');
		return array( 
			'resource' => $this->resource->toArray(),
			'object' => $this->resource->getView()->getInformations('name'),
			'form' => $form
		);
	}

	public function doDelete( SfRequest $request )
{'fraction_non_alphanumeric': 0.1829004329004329, 'fraction_numerical': 0.0, 'mean_word_length': 4.602020202020202, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, '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': '4883444', 'n_tokens_mistral': 949, 'n_tokens_neox': 853, 'n_words': 154}