接口致命错误


Interface Fatal Error

这是我在Entity文件夹中新创建的页面上的代码。。。

use Doctrine'ORM'Mapping as ORM;
use Application'Entity'Categories;
use PerfectWeb'Core'Interfaces'Routable;
use Application'Mapper'Injector;
use PerfectWeb'Core'Traits;
use PerfectWeb'Core'View'Helper'Object;
use PerfectWeb'Core'Utils'Slug;
/**
 * @ORM'Entity
 */
class VodCategory extends Categories implements 
Entity'Interfaces'Categories, Routable
{
    function getRoute($type = Object::ROUTE_TYPE_VIEW)
    {
        return 'category/categories';
    }
    function getRouteParams()
    {
        return
            [
            Injector::CATEGORY => $this->getID(),
            'slug' => Slug::getSlug($this->getSlug()),
            ];
    }
}

这是我的category.php文件:

<?php
namespace Application'Entity;
use Doctrine'Common'Collections'ArrayCollection;
use Doctrine'ORM'Mapping as ORM;
use PerfectWeb'Core'Traits;
/**
 * Categories
 * @ORM'Table(name="categories")
 * @ORM'Entity
 */
class Categories
{
    use Traits'Entity;
    use Traits'User;
    use Traits'Name;
    /**
     * @var integer
     *
     * @ORM'Column(name="id", type="integer", nullable=false)
     * @ORM'Id
     * @ORM'GeneratedValue(strategy="AUTO")
     */
    protected $id;
    /**
     * @var string
     *
     * @ORM'Column(name="name", type="string", nullable=false, unique=false)
     */
    protected $name;
    /**
     * @ORM'ManyToOne(targetEntity="Categories", cascade={"persist"})
     * @ORM'JoinColumn(name="parent_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
     * @var integer
     */
    protected $parent = null;
    /**
     * @var 'Application'Entity'User
     *
     * @ORM'ManyToOne(targetEntity="User", inversedBy="categories")
     * @ORM'JoinColumn(name="user", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $user;
    /**
     *
     * @ORM'OneToMany(targetEntity="Videos'Entity'Video", mappedBy="category", fetch="EXTRA_LAZY"))
     *
     */
    protected $videos;
    /**
     * @var string
     *
     * @ORM'Column(name="entity", type="string", nullable=true, unique=false)
     */
    protected $entity;
    /**
     *
     * construct function for array collection
     */
    public function __construct()
    {
        $this->videos = new ArrayCollection();
    }
    /**
     * @return mixed
     */
    public function getVideos()
    {
        return $this->videos;
    }
    /**
     * @param mixed $videos
     */
    public function setVideos($videos)
    {
        $this->videos = $videos;
    }
    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Get parent
     *
     * @return integer
     */
    public function getParent()
    {
        return $this->parent;
    }
    /**
     * Set parent
     *
     * @param integer $parent
     * @return Categories
     */
    public function setParent($parent)
    {
        $this->parent = $parent;
        return $this;
    }
    public function __toString()
    {
        return $this->getName();
    }
}

代码的第一位给了我一个错误:

在/var/www/html/camclients/module/Videos/src/Videos/Entity/VodCategory.php 中找不到致命错误接口"Categories''Entity''Interfaces''Categories"

我做错了什么?

您在类别类中实现了接口Entity'Interfaces'Categories,但找不到此接口。您应该在该命名空间(和文件夹)中有一个接口,或者您应该指向正确的位置(接口所在的文件夹/命名空间)。

如果你的接口存在,那么它可能是一个命名空间问题,比如评论中建议的@doydoy44。然后确保接口的namespace声明和文件位置是正确的。