duanlu9557 2019-01-27 06:34
浏览 1037

异常'Symfony \ Component \ Debug \ Exception \ FatalThrowableError',带有消息'调用未定义的方法getFeedsEntity()'i

Exception 'Symfony\Component\Debug\Exception\FatalThrowableError' with message 'Call to undefined method Perform\Feeds\Data\Article\Entity::getFeedsEntity()' in /var/www/sportingnews/releases/6.12.0-go/app/Models/Data/AdobeDTM/Model.php:94

I have tried in previous versions and it is working fine in the previous versions. Following is the line throwing error:

$author = $this->author->withArticle($article->getFeedsEntity()); Can anybody help why it is throwing error?

<?php

namespace App\Models\Data\AdobeDTM;

use App\Services\Article\Author;
use Illuminate\Routing\Router;
use Perform\Laravel\Locales\Service as LocalesService;

class Model
{
    private $author;
    private $localesService;
    private $router;

    public function __construct(
        Author $author,
        LocalesService $localesService,
        Router $router
    ) {
        $this->author = $author;
        $this->localesService = $localesService;
        $this->router = $router;
    }

    public function getNbaAdobeDtmSrc() :string
    {
        $localeToSrcMap = [
            'au' => '//assets.adobedtm.com/1d1f22b7fbd1c6b82b92f8fffd66868071b86080/satelliteLib-7a2318cde68759d4f6b8ae79f4ac6cefe8d9584f.js',
            'jp' => '//assets.adobedtm.com/1d1f22b7fbd1c6b82b92f8fffd66868071b86080/satelliteLib-18b8a632d390a5d9e96a3e41b7d99d5138b2f811.js',
        ];

        $locale = $this->localesService->getLocale();
        $src = $localeToSrcMap[$locale] ?? '';

        if (empty($src)) {
            throw new \Exception("The AdobeDTM head tag's src attribute is not configured for locale: $locale.");
        }

        return $src;
    }

    public function getDigialData($pageModel): array
    {
        $dataAttributes = $this->getDataAttributesByPage($pageModel);

        return $dataAttributes->getValues();
    }

    private function getDataAttributesByPage($pageModel)
    {
        if (get_class($pageModel) == \App\Models\Pages\Error\Model::class) {
            return new \App\Models\Data\AdobeDTM\DataAttributes\NullModel($this->localesService);
        }
        switch ($this->router->currentRouteName()) {
            case 'sectionFront':
                return new \App\Models\Data\AdobeDTM\DataAttributes\SectionFront($this->localesService);
                break;
            case 'sectionArchive':
                return new \App\Models\Data\AdobeDTM\DataAttributes\Archive($this->localesService);
                break;
            case 'article':
                $article = $pageModel->getArticle();
                $meta = $pageModel->getTagNames();
                $author = $this->author->withArticle($article->getFeedsEntity());
                return new \App\Models\Data\AdobeDTM\DataAttributes\Article(
                    $this->localesService,
                    $article->getHeadline(),
                    $article->getArticleId(),
                    $author->getName(),
                    implode(',', $meta)
                );
                break;
            case 'videoHubSport':
                $videoTitle = $pageModel->getCurrentVideo()->title;
                return new \App\Models\Data\AdobeDTM\DataAttributes\VideoHub($this->localesService, $videoTitle);
                break;
            case 'videoHubVideo':
                $videoTitle = $pageModel->getCurrentVideo()->title;
                return new \App\Models\Data\AdobeDTM\DataAttributes\VideoDetail($this->localesService, $videoTitle);
                break;
            case 'gallery':
                $article = $pageModel->getArticle();
                $meta = $pageModel->getTagNames();
                return new \App\Models\Data\AdobeDTM\DataAttributes\Gallery(
                    $this->localesService,
                    $article->headline,
                    $article->id,
                    implode(',', $meta)
                );
                break;
            case 'slideList':
                $article = $pageModel->getArticle();
                $meta = $pageModel->getTagNames();
                $author = $this->author->withArticle($article->getFeedsEntity());
                
                return new \App\Models\Data\AdobeDTM\DataAttributes\Slidelist(
                    $this->localesService,
                    $article->headline,
                    $article->id,
                    $author->getName(),
                    implode(',', $meta)
                );
                break;
            default:
                return new \App\Models\Data\AdobeDTM\DataAttributes\NullModel($this->localesService);
        }
    }
}

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器