php - 异常 'Symfony\Component\Debug\Exception\FatalThrowableError' 带有消息'调用未定义的方法 getFeedsEntity()' 我
问题描述
在 /var/www/sportingnews/releases/6.12.0-go/ 中出现异常“Symfony\Component\Debug\Exception\FatalThrowableError”和消息“调用未定义方法 Perform\Feeds\Data\Article\Entity::getFeedsEntity()”应用程序/模型/数据/AdobeDTM/Model.php:94
我在以前的版本中尝试过,它在以前的版本中运行良好。以下是行抛出错误:
$author = $this->author->withArticle($article->getFeedsEntity()); 任何人都可以帮助它为什么抛出错误?
<?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);
}
}
}
解决方案
推荐阅读
- .htaccess - .htaccess 从子文件夹重定向到域无法正常工作
- python - Donkey Car S1 - Raspberry pi + Robo Hat MM1+ 不想使用 Donkeycar API
- visual-studio-code - VS Code 中的终端看起来不像以前,想要下拉
- javascript - 示例 node.js ftp 服务器?
- android - 使用自定义资源值(例如 int、float)的 Android Vector
- android - 如何使用刀柄在片段中注入视图模型模拟
- async-await - 如何使用 AsyncHTMLSession().run 的参数构建异步任务列表?
- sql - SQL 需要帮助来分配唯一编号或基于日期从最早到最新以及基于产品名称和价格的序列号
- sql-server - Laravel MSSQL 将数据类型 nvarchar 转换为 int 时出错。在窗户上
- schema - 具有 json、NIfi 数组的字段的 Avro Schema