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 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛