<commit_before><?php

namespace Oro\Bundle\EntityBundle\Manager\Api;

use FOS\RestBundle\Util\Codes;

use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;

use Oro\Bundle\EntityBundle\Tools\EntityRoutingHelper;
use Oro\Bundle\EntityBundle\Entity\Manager\Field\EntityFieldManager;
use Oro\Bundle\EntityBundle\Exception\FieldUpdateAccessException;

class EntityDataApiManager
{
    /** @var  EntityFieldManager */
    protected $entityDataManager;

    /** @var  AuthorizationChecker */
    protected $securityService;

    /** @var EntityRoutingHelper */
    protected $entityRoutingHelper;

    /**
     * @param EntityFieldManager   $entityDataManager
     * @param AuthorizationChecker $securityService
     * @param EntityRoutingHelper  $entityRoutingHelper
     */
    public function __construct(
        EntityFieldManager $entityDataManager,
        AuthorizationChecker $securityService,
        EntityRoutingHelper $entityRoutingHelper
    ) {
        $this->entityDataManager = $entityDataManager;
        $this->securityService = $securityService;
        $this->entityRoutingHelper = $entityRoutingHelper;
    }

    /**
     * @param string $className
     * @param int    $id
     * @param array  $data
     *
     * @return array
     *
     * @throws \Exception
     */
    public function patch($className, $id, $data)
    {
        $entity = $this->entityRoutingHelper->getEntity($className, $id);

        if (!$this->securityService->isGranted('EDIT', $entity)) {
            throw new AccessDeniedException();
        }

        try {
            return $this->entityDataManager->update($entity, $data);<commit_msg>BAP-9263: Disabled fields should not be editable in inline editing<commit_after><?php

namespace Oro\Bundle\EntityBundle\Manager\Api;

use FOS\RestBundle\Util\Codes;

use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;

use Oro\Bundle\EntityBundle\Tools\EntityRoutingHelper;
use Oro\Bundle\EntityBundle\Entity\Manager\Field\EntityFieldManager;
use Oro\Bundle\EntityBundle\Exception\FieldUpdateAccessException;

class EntityDataApiManager
{
    /** @var  EntityFieldManager */
    protected $entityDataManager;

    /** @var  AuthorizationChecker */
    protected $securityService;

    /** @var EntityRoutingHelper */
    protected $entityRoutingHelper;

    /**
     * @param EntityFieldManager   $entityDataManager
     * @param AuthorizationChecker $securityService
     * @param EntityRoutingHelper  $entityRoutingHelper
     */
    public function __construct(
        EntityFieldManager $entityDataManager,
        AuthorizationChecker $securityService,
        EntityRoutingHelper $entityRoutingHelper
    ) {
        $this->entityDataManager = $entityDataManager;
        $this->securityService = $securityService;
        $this->entityRoutingHelper = $entityRoutingHelper;
    }

    /**
     * @param string $className
     * @param int    $id
     * @param array  $data
     *
     * @return array
     *
     * @throws AccessDeniedException
     */
    public function patch($className, $id, $data)
    {
        $entity = $this->entityRoutingHelper->getEntity($className, $id);

        if (!$this->securityService->isGranted('EDIT', $entity)) {
            throw new AccessDeniedException();
        }

        try {
            return $this->entityDataManager->update($entity, $data);
{'fraction_non_alphanumeric': 0.10392938496583143, 'fraction_numerical': 0.0011389521640091116, 'mean_word_length': 3.3157248157248156, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6345609', 'n_tokens_mistral': 939, 'n_tokens_neox': 960, 'n_words': 176}