<commit_before><?php

namespace Oro\Bundle\EntityBundle\Controller\Api\Rest;

use FOS\RestBundle\Controller\Annotations\NamePrefix;
use FOS\RestBundle\Controller\Annotations\RouteResource;
use FOS\RestBundle\Controller\Annotations\Get;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Routing\ClassResourceInterface;
use FOS\RestBundle\Util\Codes;

use Nelmio\ApiDocBundle\Annotation\ApiDoc;

use Symfony\Component\HttpFoundation\Response;

use Oro\Bundle\EntityBundle\ORM\EntityAliasResolver;
use Oro\Bundle\EntityBundle\Tools\EntityClassNameHelper;

/**
 * @RouteResource("entity_alias")
 * @NamePrefix("oro_api_")
 */
class EntityAliasController extends FOSRestController implements ClassResourceInterface
{
    /**
     * Get entity aliases.
     *
     * @Get("/entities/aliases")
     *
     * @ApiDoc(
     *      description="Get entity aliases",
     *      resource=true
     * )
     *
     * @return Response
     */
    public function cgetAction()
    {
        /** @var EntityAliasResolver $resolver */
        $resolver = $this->get('oro_entity.entity_alias_resolver');
        /** @var EntityClassNameHelper $entityClassNameHelper */
        $entityClassNameHelper = $this->get('oro_entity.entity_class_name_helper');
        /** @var  $entityClassNameHelper */
        $entityConfigManager = $this->get('oro_entity_config.config_manager');

        $result = [];
        foreach ($resolver->getAll() as $className => $entityAlias) {
            $config = $entityConfigManager->getEntityConfig('extend', $className);
            
            $result[] = [
                'entity'      => $className,
                'alias'       => $entityAlias->getAlias(),
                'pluralAlias' => $entityAlias->getPluralAlias(),
                'urlSafeName' => $entityClassNameHelper->getUrlSafeClassName($className),
                'costomEnaity' => $config->get('owner') !== 'System'
            ];
        }

        return $this->handleView($this->view($result, Codes::HTTP_OK));
    }
}<commit_msg>OEE-779: Incorrect behavior of Custom and some Oro entities on Outlook sidebar panel<commit_after><?php

namespace Oro\Bundle\EntityBundle\Controller\Api\Rest;

use FOS\RestBundle\Controller\Annotations\NamePrefix;
use FOS\RestBundle\Controller\Annotations\RouteResource;
use FOS\RestBundle\Controller\Annotations\Get;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Routing\ClassResourceInterface;
use FOS\RestBundle\Util\Codes;

use Nelmio\ApiDocBundle\Annotation\ApiDoc;

use Symfony\Component\HttpFoundation\Response;

use Oro\Bundle\EntityBundle\ORM\EntityAliasResolver;
use Oro\Bundle\EntityBundle\Tools\EntityClassNameHelper;

/**
 * @RouteResource("entity_alias")
 * @NamePrefix("oro_api_")
 */
class EntityAliasController extends FOSRestController implements ClassResourceInterface
{
    /**
     * Get entity aliases.
     *
     * @Get("/entities/aliases")
     *
     * @ApiDoc(
     *      description="Get entity aliases",
     *      resource=true
     * )
     *
     * @return Response
     */
    public function cgetAction()
    {
        /** @var EntityAliasResolver $resolver */
        $resolver = $this->get('oro_entity.entity_alias_resolver');
        /** @var EntityClassNameHelper $entityClassNameHelper */
        $entityClassNameHelper = $this->get('oro_entity.entity_class_name_helper');
        /** @var  $entityClassNameHelper */
        $entityConfigManager = $this->get('oro_entity_config.config_manager');

        $result = [];
        foreach ($resolver->getAll() as $className => $entityAlias) {
            $customEntity = false;
            if ($entityConfigManager->hasConfig($className)) {
                $config = $entityConfigManager->getEntityConfig('extend', $className);
                $customEntity = $config->get('owner') !== 'System';
            }

            $result[] = [
                'entity'      => $className,
                'alias'       => $entityAlias->getAlias(),
                'pluralAlias' => $entityAlias->getPluralAlias(),
                'urlSafeName' => $entityClassNameHelper->getUrlSafeClassName($className),
                'costomEnaity' => $customEntity
            ];
        }

        return $this->handleView($this->view($result, Codes::HTTP_OK));
    }
}
{'fraction_non_alphanumeric': 0.13012104283054005, 'fraction_numerical': 0.0006983240223463687, 'mean_word_length': 2.9676823638042475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, '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': '6204645', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1200, 'n_words': 184}