doxzrb8721 2016-01-05 09:00
浏览 53
已采纳

接口致命错误

So this is my code on my newly created page inside the Entity folder...

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()),
            ];
    }
}

And this is my category.php file:

<?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();
    }
}

the first bit of code gives me an error:

Fatal Error Interface 'Categories\Entity\Interfaces\Categories' not found in /var/www/html/camclients/module/Videos/src/Videos/Entity/VodCategory.php

What am I doing wrong?

  • 写回答

1条回答 默认 最新

  • dpnzf48660 2016-01-05 09:23
    关注

    You implement the interface Entity\Interfaces\Categories inside your category class but this interface cannot be found. You should have an interface in that namespace (and folder) or you should point to the correct location (the folder/namespace where your interface is located).

    If your interface exists then it is probably a namespace issue like @doydoy44 suggested in the comment. Then make sure that the namespace declaration and file location of your interface are correct.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化