Parses product content data to an array.

@param ProductTranslation $productTranslation

@return array
439468
private function parseContentToArray(ProductTranslation $productTranslation)
    {
        $routePath = null;
        if ($productTranslation->getRoute()) {
            $routePath = $productTranslation->getRoute()->getPath();
        }

        return [
            'title' => $productTranslation->getContentTitle(),
            'routePath' => $routePath,
        ];
    }
897548
public function postPersist(ProductTranslationEvent $productTranslationEvent)
    {
        $this->productRouteManager->saveRoute($productTranslationEvent->getProductTranslation());
        $this->entityManager->flush();
    }
516899
public function getFieldsTranslations()
    {
        if (! $this->_targetModel instanceof \MUtil_Model_ModelAbstract) {
            throw new \MUtil_Model_ModelTranslateException(sprintf('Called %s without a set target model.', __FUNCTION__));
        }
        $this->_targetModel->set('gto_id_token', 'label', $this->_('Token'),
                'import_descr', $this->loader->getTracker()->getTokenLibrary()->getFormat(),
                'required', true,
                'order', 2
                );

        return array('token' => 'gto_id_token') + parent::getFieldsTranslations();
    }
224653
public function getAllTranslations()
    {
        $this->loadTranslations($this->currentLanguage);

        if (!isset($this->translations[$this->currentLanguage])) {
            return array();
        }

        return $this->translations[$this->currentLanguage];
    }
1169688
public function toArray($withTranslations = true)
    {
        $attributes = parent::toArray();

        if ($withTranslations && $this->hasTranslatedAttributes()) {
            foreach ($this->getTranslatedAttributes() as $field) {
                if ($translations = $this->getTranslation()) {
                    $attributes[$field] = $translations->$field;
                }
            }
        }

        return $attributes;
    }
1150065
public function getAttributes()
    {
        $attributeEntities = $this->entity->getProductAttributes();

        $attributes = [];
        foreach ($attributeEntities as $attributesEntity) {
            $attributes[] = new ProductAttribute(
                $attributesEntity,
                $this->locale,
                $this->productLocaleManager->getFallbackLocale()
            );
        }

        return $attributes;
    }
476700
public function getDataSubArray(QuoteTransfer $quoteTransfer, ComputopApiRequestTransfer $requestTransfer): array
    {
        $dataSubArray[ComputopApiConfig::MERCHANT_ID] = $requestTransfer->getMerchantId();
        $dataSubArray[ComputopApiConfig::TRANS_ID] = $requestTransfer->getTransId();
        $dataSubArray[ComputopApiConfig::ORDER_DESC] = $requestTransfer->getOrderDesc();
        $dataSubArray[ComputopApiConfig::AMOUNT] = $requestTransfer->getAmount();
        $dataSubArray[ComputopApiConfig::CURRENCY] = $requestTransfer->getCurrency();
        $dataSubArray[ComputopApiConfig::MAC] = $this->computopApiService->generateEncryptedMac($requestTransfer);
        $dataSubArray[ComputopApiConfig::PRODUCT_NAME] = $this->config->getCrifProductName();
        $dataSubArray[ComputopApiConfig::CUSTOMER_ID] = $quoteTransfer->getCustomer()->getCustomerReference();
        $dataSubArray[ComputopApiConfig::LEGAL_FORM] = $this->config->getCrifLegalForm();
        $dataSubArray[ComputopApiConfig::FIRST_NAME] = $quoteTransfer->getShippingAddress()->getFirstName();
        $dataSubArray[ComputopApiConfig::LAST_NAME] = $quoteTransfer->getShippingAddress()->getLastName();
        $dataSubArray[ComputopApiConfig::ADDRESS_STREET] = $quoteTransfer->getShippingAddress()->getAddress1();
        $dataSubArray[ComputopApiConfig::ADDRESS_STREET_NR] = $quoteTransfer->getShippingAddress()->getAddress2();
        $dataSubArray[ComputopApiConfig::ADDRESS_ADDITIONAL] = $quoteTransfer->getShippingAddress()->getAddress3();
        $dataSubArray[ComputopApiConfig::ADDRESS_CITY] = $quoteTransfer->getShippingAddress()->getCity();
        $dataSubArray[ComputopApiConfig::ADDR_ZIP] = $quoteTransfer->getShippingAddress()->getZipCode();
        $dataSubArray[ComputopApiConfig::ADDR_EMAIL] = $quoteTransfer->getCustomer()->getEmail();
        $dataSubArray[ComputopApiConfig::PHONE] = $quoteTransfer->getShippingAddress()->getPhone();

        return $dataSubArray;
    }
689612
public function getLoadedProductCollection()
    {
        $params = $this->getRequest()->getParams();
        if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) {
            $this->helper->log('Most viewed no valid code is set');
            return [];
        }

        $productsToDisplay = [];
        $mode = $this->getRequest()->getActionName();
        $limit = $this->recommnededHelper->getDisplayLimitByMode($mode);
        $from  = $this->recommnededHelper->getTimeFromConfig($mode);
        $to = $this->_localeDate->date()->format(\Zend_Date::ISO_8601);
        $catId = $this->getRequest()->getParam('category_id');
        $catName = $this->getRequest()->getParam('category_name');

        $reportProductCollection = $this->catalog->getMostViewedProductCollection($from, $to, $limit, $catId, $catName);

        //product ids from the report product collection
        $productIds = $reportProductCollection->getColumnValues('entity_id');

        $productCollection = $this->catalog->getProductCollectionFromIds($productIds);

        //product collection
        foreach ($productCollection as $_product) {
            //add only saleable products
            if ($_product->isSalable()) {
                $productsToDisplay[] = $_product;
            }
        }

        return $productsToDisplay;
    }
909311
public function trans($toTranslate, $params = [], $forceLang = '')
    {
        $toTranslate = strtolower($toTranslate);
        $this->_getParams($toTranslate, $params);
        $toTranslate = trim($toTranslate);
        // If there isn't a dot we'll append one just to avoid the "undefined offset 1" warning
        if (false === strpos('.', $toTranslate)) {
            $toTranslate .= '.';
        }

        list($fileName, $key) = $this->parseFileKey($toTranslate);
        $langArray = $this->langFile($fileName, $forceLang);

        $value = isset($langArray[$key]) ? $langArray[$key] : $key;
        if (is_numeric(strpos($value, ':'))
            && !empty($params)
            && is_array($params)
        ) {
            $value = $this->_setParams($value, $params);
        }

        return $value;
    }
781764
public function getTranslationsAttribute()
    {
        $translationData = [];
        $translations = Translation::where('entity_id', $this->id)->where('entity_type', get_class($this))->get();

        foreach ($translations as $translation) {
            $translationData[] = $translation->data->attributes;
        }

        return $translationData;
    }
1201624
static public function parseFile($file, KTranslatorInterface $translator)
    {
        $strings   = array();
        $catalogue = $translator->getCatalogue();

        // Catch exceptions if any.
        try {
            $translations = $translator->getObject('object.config.factory')->fromFile($file);
        }  catch (Exception $e) {
            $translations = array();
        }

        foreach ($translations as $key => $value) {
            $strings[$catalogue->getPrefix() . $catalogue->generateKey($key)] = $value;
        }

        return $strings;
    }
687996
public function getAllRoutesOfProduct(ProductInterface $product)
    {
        $urls = [];
        /** @var ProductTranslation $productTranslation */
        foreach ($product->getTranslations() as $productTranslation) {
            if ($productTranslation->getRoute()) {
                $urls[$productTranslation->getLocale()] = $productTranslation->getRoute()->getPath();
            }
        }

        return $urls;
    }
714449
public function getFirstBrandByProductAbstractId(ProductAbstractTransfer $productAbstractTransfer): ?BrandTransfer
    {
        $productAbstractTransfer->requireIdProductAbstract();

        return $this->brandProductRepository->getFirstBrandByProductAbstractId($productAbstractTransfer->getIdProductAbstract());
    }
168309
public function getTranslations(
        array $domains = [],
        array $languages = [],
        callable $filter = null
    ) : array {
        return $this
            ->translationCollection
            ->getTranslations(
                $domains,
                $languages,
                $filter
            );
    }
288779
public function saveProductListCustomerRelation(
        ProductListCustomerRelationTransfer $productListCustomerRelationTransfer
    ): ProductListCustomerRelationTransfer {
        return $this->getTransactionHandler()->handleTransaction(
            function () use ($productListCustomerRelationTransfer) {
                return $this->executeSaveProductListCustomerRelationTransaction($productListCustomerRelationTransfer);
            }
        );
    }
620912
private function getContentTranslationSubdocuments(Content $content, $languageCode)
    {
        if ($this->contentTranslationSubdocumentMapper->accept($content, $languageCode)) {
            return $this->contentTranslationSubdocumentMapper->mapDocuments($content, $languageCode);
        }

        return [];
    }
978870
public function transform($translation)
    {
        $translation = $this->entityToArray(FileTranslation::class, $translation);
        return [
            'id'          => (int) $translation['id'],
            'langCode'    => $translation['lang_code'],
            'title'       => $translation['title'],
            'description' => $translation['description'],
            'createdAt'   => $translation['created_at'],
            'updatedAt'   => $translation['updated_at'],
        ];
    }