Php 扩展$many\u many上的博客模块错误
我正在使用Silverstipe/Blog模块作为我的基本Blog功能。我将扩展一个字段,该字段具有与Category和Tags相同的功能 不幸的是,$many\u many无法处理我的扩展文件 这就是我正在经历的错误 [紧急情况]未捕获逻辑异常:属于多个关系MyProject\Model\BlogIndustry.BlogPosts指向SilverStripe\Blog\Model\BlogPost,但不匹配多个 这是我的附加数据对象Php 扩展$many\u many上的博客模块错误,php,silverstripe-4,Php,Silverstripe 4,我正在使用Silverstipe/Blog模块作为我的基本Blog功能。我将扩展一个字段,该字段具有与Category和Tags相同的功能 不幸的是,$many\u many无法处理我的扩展文件 这就是我正在经历的错误 [紧急情况]未捕获逻辑异常:属于多个关系MyProject\Model\BlogIndustry.BlogPosts指向SilverStripe\Blog\Model\BlogPost,但不匹配多个 这是我的附加数据对象 <?php namespace MyProject
<?php
namespace MyProject\Model;
use SilverStripe\ORM\DataObject;
use Silverstripe\Blog\Model\BlogObject;
use Silverstripe\Blog\Model\CategorisationObject;
use SilverStripe\Blog\Model\Blog;
use SilverStripe\Blog\Model\BlogPost;
/**
* A blog tag for keyword descriptions of a blog post.
*
*
* @method Blog Blog()
*
* @property string $Title
* @property string $URLSegment
* @property int $BlogID
*/
class BlogIndustry extends DataObject implements CategorisationObject
{
/**
* Use an exception code so that attempted writes can continue on
* duplicate errors.
*
* @const string
* This must be a string because ValidationException has decided we can't use int
*/
const DUPLICATE_EXCEPTION = 'DUPLICATE';
/**
* {@inheritDoc}
* @var string
*/
private static $table_name = 'EllisCo_BlogIndustry';
/**
* @var array
*/
private static $db = [
'Title' => 'Varchar(255)',
'URLSegment' => 'Varchar(255)'
];
/**
* @var array
*/
private static $has_one = [
'Blog' => Blog::class
];
/**
* @var array
*/
private static $belongs_many_many = [
'BlogPosts' => BlogPost::class
];
/**
* {@inheritdoc}
*/
protected function getListUrlSegment()
{
return 'industry';
}
/**
* {@inheritdoc}
*/
protected function getDuplicateError()
{
return _t(__CLASS__ . '.Duplicate', 'A blog industry already exists with that name.');
}
}
非常感谢您的帮助。好的,我已经成功了。我错误地为我的命名空间设置了一个错误的路径 感谢您收看本期节目的朋友:)
private static $many_many = [
"Industries" => BlogIndustry::class,
];