Php 接口致命错误

Php 接口致命错误,php,symfony,zend-framework2,doctrine,Php,Symfony,Zend Framework2,Doctrine,这是我在实体文件夹中新创建的页面上的代码 这是我的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") * @O

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

这是我的
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();
    }
}

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


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

您的实体未找到
实体\接口\类别
接口。你的界面在哪里?我想你忘记了接口名称空间之前的
Application\
。我修复了我的接口错误。通过删除它,只是实现了routable,但我的代码没有完成它应该做的…我有一个视频缩略图表,每个分区都有视频标题和该视频的类别。当有人单击类别时名称它必须在列表中列出类别和视频categories@DLMike这是一个新问题。如果您想获得下一期的帮助,请关闭此问题并发布新问题。。。
<?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();
    }
}