/var/www/sportingnews/releases/6.12.0中出现异常'Symfony \ Component \ Debug \ Exception \ FatalThrowableError',消息为'调用未定义方法Perform \ Feeds \ Data \ Article \ Entity :: getFeedsEntity() -go / app / Models / Data / 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);
}
}
}