<commit_before><?php
/**
 * This file is part of the Kappa\DoctrineMPTT package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the license.md
 * file that was distributed with this source code.
 */

namespace Kappa\DoctrineMPTT\Queries\Objects\Manipulators;

use Kappa\Doctrine\Queries\Executable;
use Kappa\DoctrineMPTT\Configurator;
use Kappa\DoctrineMPTT\Entities\TraversableInterface;
use Kappa\DoctrineMPTT\Utils\StringComposer;
use Kdyby\Doctrine\QueryBuilder;

/**
 * Class UpdateLeftForDelete
 *
 * @package Kappa\DoctrineMPTT\QueryObjects\Updates
 * @author <NAME> <http://zaruba-ondrej.cz>
 */
class UpdateLeftForDelete implements Executable
{
	/** @var Configurator */
	private $configurator;

	/** @var TraversableInterface */
	private $actual;

	/**
	 * @param Configurator $configurator
	 * @param TraversableInterface $actual
	 */
	public function __construct(Configurator $configurator, TraversableInterface $actual)
	{
		$this->configurator = $configurator;
		$this->actual = $actual;
	}

	/**
	 * @param QueryBuilder $queryBuilder
	 * @return QueryBuilder
	 */
	public function build(QueryBuilder $queryBuilder)
	{
		$class = $this->configurator->get(Configurator::ENTITY_CLASS);
		$stringComposer = new StringComposer([
			':leftName:' => $this->configurator->get(Configurator::LEFT_NAME),
			':_leftName:' => $this->configurator->get(Configurator::ORIGINAL_LEFT_NAME),
			':difference:' => $this->actual->getRight() - $this->actual->getLeft() + 1
		]);
		$queryBuilder->update($class, 'e')
			->set($stringComposer->compose('e.:leftName:'), $stringComposer->compose('e.:leftName: - :difference:'))
			->set($stringComposer->compose('e.:_leftName:'), $stringComposer->compose('e.:leftName:'))
			->where($stringComposer->compose('e.:leftName: > ?0'))
			->setParameters([$this->actual->getRight()]);

		return $queryBuilder;
	}
}
<commit_msg>Fixed update tmp left column<commit_after><?php
/**
 * This file is part of the Kappa\DoctrineMPTT package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the license.md
 * file that was distributed with this source code.
 */

namespace Kappa\DoctrineMPTT\Queries\Objects\Manipulators;

use Kappa\Doctrine\Queries\Executable;
use Kappa\DoctrineMPTT\Configurator;
use Kappa\DoctrineMPTT\Entities\TraversableInterface;
use Kappa\DoctrineMPTT\Utils\StringComposer;
use Kdyby\Doctrine\QueryBuilder;

/**
 * Class UpdateLeftForDelete
 *
 * @package Kappa\DoctrineMPTT\QueryObjects\Updates
 * @author <NAME> <http://zaruba-ondrej.cz>
 */
class UpdateLeftForDelete implements Executable
{
	/** @var Configurator */
	private $configurator;

	/** @var TraversableInterface */
	private $actual;

	/**
	 * @param Configurator $configurator
	 * @param TraversableInterface $actual
	 */
	public function __construct(Configurator $configurator, TraversableInterface $actual)
	{
		$this->configurator = $configurator;
		$this->actual = $actual;
	}

	/**
	 * @param QueryBuilder $queryBuilder
	 * @return QueryBuilder
	 */
	public function build(QueryBuilder $queryBuilder)
	{
		$class = $this->configurator->get(Configurator::ENTITY_CLASS);
		$stringComposer = new StringComposer([
			':leftName:' => $this->configurator->get(Configurator::LEFT_NAME),
			':_leftName:' => $this->configurator->get(Configurator::ORIGINAL_LEFT_NAME),
			':difference:' => $this->actual->getRight() - $this->actual->getLeft() + 1
		]);
		$queryBuilder->update($class, 'e')
			->set($stringComposer->compose('e.:leftName:'), $stringComposer->compose('e.:leftName: - :difference:'))
			->set($stringComposer->compose('e.:_leftName:'), $stringComposer->compose('e.:_leftName: - :difference:'))
			->where($stringComposer->compose('e.:leftName: > ?0'))
			->setParameters([$this->actual->getRight()]);

		return $queryBuilder;
	}
}

{'fraction_non_alphanumeric': 0.1593449441122953, 'fraction_numerical': 0.0010397712503249284, 'mean_word_length': 5.226537216828479, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 69, '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': '977237', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1257, 'n_words': 229}